Mixed Reality Toolkit Reflection Extension Method

I received a question a few weeks back about getting the Curved VR Keyboard to work on the HoloLens.

The error message appeared to be a reflection issue. UWP has some issues working with reflection because UWP is not managed. It is native and has a projection that allows us to write JavaScript apps or C# apps (and other languages) and it does the projection. This is really nice because we can write code using the language we like and deploy it to the Windows Store.

However, this means that some of the reflection APIs don’t quite work.

In particular, trying to call GetProperty or the like can cause issues. Fortunately, when it comes to Unity this is solved by the Mixed Reality Toolkit. There is a handy extension method that was created on the system’s Type class. The GetBaseType extension method will return the correct base type for UWP as well as when the code is running in the Unity Editor.

This is done using compiler directives (like #if UNITY_WSA && !UNITY_EDITOR ).

If you are trying to use a Unity Asset Store asset, like the Curved VR Keyboard, on the HoloLens or an immersive headset to run in the Windows Store, then you’ll want to avoid using reflection, or if it is needed, make sure you grab the appropriate base type.

Here is a video I created as I blindly tackled the problem.

HoloValentine One Year Anniversary

Around this time last year, I created a HoloLens app called HoloValentine and released it to the Windows Store. Later last year, sometime in November, I updated the code to have it work on the immersive Mixed Reality (or VR) headsets.

Here’s a little demo of how it works on the IHMD (Immersive Head Mounted Displays). I could have spent some time creating an actual environment, but let’s not talk about what might have been

If you have a IHMD … or a HoloLens, go ahead and try it out. It’s free 🙂

https://www.microsoft.com/en-us/store/p/holovalentine/9n20ttvcxh2q

You can also grab the source code at http://chd.me/holovalentine

You can watch the series that was inspired by this game at: http://chadcarter.net/getting-started-with-mixed-reality/

The 4 Simple Steps to Develop Your Own Mixed Reality Experiences… for Fun and Profit!

LHL Webinar

Join me Thursday, February 8th at 10AM over at LearnHoloLens.com where I’ll be talking about…

The 4 Simple Steps to Develop Your Own Mixed Reality Experiences… for Fun and Profit!

This webinar will cover HoloLens development as well as development for the immersive Windows Mixed Reality headsets.

You will not want to miss this! See you on the FREE webinar!

Sneak Peek into a Live Q&A Session at LearnHoloLens.com

Every month, I answer questions from the members of LearnHoloLens.com. The questions are usually around content from the monthly master classes I teach there, but sometimes they are general mixed reality or Unity topics.

I put the video on YouTube where you can watch part of one of the 18 Live Q&As.

The Learn HoloLens membership site is usually closed so I can focus on the content and supporting my members. However, I’ve opened it up until Sunday night, February 11th, 2018 at Midnight ET.

So you have about 11 days to see if it is something you want to pursue.

Every month there is a new Master Class available. When you signup you get immediate access to all the previous master classes.

These include topics like world anchors, spatial mapping, spatial understanding, shadows, particles, shaders, voice recognition, spatial audio, submitting to the store, magic windows, animations, using the emulator, simulating shadows, nav meshes, and networking.

The materials really focus on Unity, so if you are a DirectX 12 / C++ dev looking to do HoloLens development, the material in the membership won’t help you too much.

But, if you want to create a game, app, or experience on the HoloLens using Unity, then you will get a lot from the material. This is true regardless if you’ve never used Unity before or if you have been working with the HoloLens consistently for the last year and half.

You will get a lot from the master classes because the material inside isn’t covered anywhere else. You will be able to ask me questions to make sure you don’t get stuck while on your HoloLens development journey.

In the membership, I show you the success path you can take so that you can create your HoloLens games, apps, or experiences in less time.

This membership is your shortcut.

Go ahead and try it out. You don’t have anything to lose.

https://LearnHoloLens.com/