MRTK + Unity + NReal

Hi, I am facing some problems with the unity Set-up of this Git https://github.com/TakashiYoshinaga/MRTK-Profiles-for-NrealLight. I followed all the steps, but when I try to build for Android (Nreal) I get errors on the Startup.cs script. 1. The type or namespace name “InitializeOnLoadAttribute” could not be found; 2. The type or namespace name “InitializeOnLoad” could not be found and 3. The type or namespace name “ScriptableSingleton<>” could not be found.

Anyone had tried this?

2 Likes

Are you using the right version of MRTK?

1 Like

Yeap. I used the 2.7.2… One thing that I am trying is to set up the XR plugin for NReal and then import the MRTK for XR plugin. However, I don’t know if I should use the XR plugin or just use the SDK from NREAL.

@alexandru.damian did you set up your environment just by importing NRSDK and MRTK?

1 Like

Hi Pedro, I’ll try to give you a step by step to the best of my knowledge:

To your other question: You need NRSDK and MRTK but also Yoshinaga’s SDK because in there is the NReal Profile for the MRTK setup!!

  1. Open which ever project you are working on or just an empty project works as well (Unity 2019.4 LTS recommended).

  2. Download Mr. Yoshinaga’s Unity package “NrealLightHandTracking.unitypackage” from this repo: https://github.com/TakashiYoshinaga/MRTK-Profiles-for-NrealLight

  3. Download the NRSDK Unity SDK 1.7.0 from https://developer.nreal.ai/download/

  4. Download the MRTK-Unity v2.7.2. IMPORTANT: I’ve had issues here before, I recommend not using the Mixed Reality Feature Tool and instead Download the SDKs directly from this side: https://github.com/microsoft/MixedRealityToolkit-Unity/releases/tag/v2.7.2
    Just scroll down and just to be sure download all 5 of them: The Extension then Extension, Examples, TestUtilities and Tools

  5. Import all of the SDKs (Yoshinaga’s, NRSDK, and all MRTK SDKs) into your project. I recommend importing them in this order.

  6. If you import them in this order you will face the MRTK setup in the end. I recommend choosing the recommended setup and just clicking continue and apply.

  7. Of course also, in the build settings, build for android. Fix all the Nreal requested changes (just click on fix when you converted your project to android). There shouldn’t be any errors now and the setup should be finished.

Now to the most important part.

  1. Let’s say you want to test hand tracking continue to the imported MRTK folder and go to the Examples folder. Next go to demos and open the hand tracking scene.
  2. Now, almost there. Basically the only thing you have to do now is choose Yoshinaga’s Nreal Hand Tracking Profile. You can do this under the “MixedRealityToolkit” Gameobject.

All that is left now is drag in the needed NReal pefabs to get the input right. For this just compare your hierarchy with Yoshinaga’s “Sample” scene from his repo (also included in his Unity package we just imported). Basically you will need to add NRCameraRig and NRInput to your hierarchy.

I hope I didn’t miss anything. I hope this helps and let me know how it goes!

3 Likes

Hello, @robi

Really thank you for the detailed tutorial. I am with a doubt regarding the topic 10. How do I choose choose Yoshinaga’s Nreal Hand Tracking Profile?

Great! Now you chan choose the Nreal Profile right below “MixedRealityToolkit”.

Now it says “DefaultHololens2ConfigurationProfile”. However, if you imported everything correctly you should be able to choose Nreal Hand Tracking Profile from the dropdown on the left side of “View Asset”.

Also quick tip for everyone struggling: If you don’t see the “Nreal Hand MixedRealityToolkitConfigurationProfile” in the dropdown menu yet, just save your project, close it and start it again. You should be able to see it now.

Hi @robi

I couldn`t see the option for NReeal Hand Tracking Profile. I even restarted my project. What Unity version of 2019.4 LTS are you using?

Tks

I am using 2019.4.30 LTS

1 Like

Hi @pedrolazarimachado

You can also my video on YouTube:

1 Like

Hi @robi

You did an excellent job here. I couldn`t use MRTK on 2019 unity versions. However, I did with 2020 versions. Worked really well.

Thank you for all the time spent!

Great, I’m glad I could help!

1 Like

Hi Robi, I am using the exactly same version of Unity(2019.4.30f1) as you, but I also cannot see the Nreal Hand MixedRealityToolkitConfigurationProfile listed in the dropdown list even after restarting Unity. I could see it by searching manually “nreal”, but just can’t use that profile in MRTK

Hi @pedrolazarimachado , did you realize hand tracking in Unity 2020? If so what is your XR configuration in MRTK configurator?

in my case the Nreal profile didn’t show up in Unity 2019.4, but has no issue in Unity 2020, but I am having gradle build errors.

Hi @xuzheyuan961124

So, you were able to run and build for Unity 2020 without errors?

Hi @pedrolazarimachado , It builds successfully on Unity 2019.4, and compiles, but I can’t get the hand tracking to work properly without importing that Nreal profile; on Unity 2020 it gives me gradle build errors

Here’s the latest update: It seems that the profile suddenly appears after I was struggling to import it for after 10 min, make sure you import everything as expected. However, hand interaction is not working properly even after importing the profile. I will give it a final shot by starting another project and see whether it works. In that case the overhead caused by the integration of MRTK and Nreal glass greatly outweighs the benefits MRTK can bring, and I would rather use NRSDK for building my scene.

not sure if it might help, but every time I setup a project with MRTK I need to do a full reimport, and restart Visual Studio after getting all the packages installed, otherwise it wont work at all for me.

dunno what’s happening on my end since I’m using Ubuntu and Monodevelop, sometimes the scripts weren’t updated immediately

I followed @robi tutorial and it works like a charm…
just that some times the hand tracking is not accurate and the raycast is not aligned with my hand position and the hand tracking experience in general is not that great
All said, its great that hand tracking capability is available in such a compact device for half the price of HoloLens 2