Migrating to MRKT2: Using Extension Services for Dependency Injection

Learn more about dependency injection and extension services for MRTK2.

Coming from business development, you might get a little shock coming into Unity. Traditionally, game developers are much more focused on making the outside prettier than the inside. Things like dependency injection are kind of unheard of or considered 'too heavy' for game development. But if you are still in the process of development, actually being able to access a consistent (mock) data service instead of the real live data service might be a big advantage, especially when that data service is rate limited or expensive.

You may also like: Migrating to MRTK2: Interacting With the Spacial Map

The Mixed Reality Toolkit 2 offers a great feature for that: extension services. And it's actually pretty easy to use, and I am going to show a simple sample. I have written about this in a very early alpha stage almost a year ago, but it's now to a point that it's actually usable.