Mixedrealitytoolkit-unity: Active Profile Switching - Unity UI is not responding

Created on 24 Sep 2019  路  10Comments  路  Source: microsoft/MixedRealityToolkit-Unity

Describe the bug

Unity UI examples in the HandInteractionExample scene do not respond to the input when the scene is loaded through Examples Hub using the Scene System. It works fine when opened as a single scene.

To reproduce

  1. Open MRTKExamplesHub
  2. Run
  3. Select Hand Interaction Examples menu (first one from the left)
  4. Interact with Unity UI examples on the right side of the scene

Expected behavior

Can interact with Unity UI

Screenshots

2019-09-24 11_46_13-Unity 2018 4 7f1 Personal - MRTKExamplesHub unity - MixedRealityToolkit-Unity -
2019-09-24 11_45_30-Unity 2018 4 7f1 Personal - MRTKExamplesHub unity - MixedRealityToolkit-Unity -

Your Setup (please complete the following information)

  • Unity Version [2018.4.7f1]
  • MRTK Version [prelease 2.1.0 stabilization]

Target Platform (please complete the following information)

Editor and HoloLens 2 device.

Bug

All 10 comments

Here's the problem, as far as I can tell.

  • MixedRealityInputModule caches an input system reference and a raycast camera reference inActivateModule(), which is called by the event system on startup.
  • The LoadProfilesOnStartup script causes MixedRealityToolkit.DestroyAllServices() to be called, which tears down all services. At that point MixedRealityInputModule's cached references point to a destroyed camera object and destroyed service.
  • The event system is never disabled / enabled from that point forward, so MixedRealityInputModule.ActivateModule() is never called again and the module no longer functions.

This is going to be a problem for anyone switching profiles regardless of scene loading.

As a kludge we could manually disable / enable the event system in our scene system load / unload calls, but that only helps people using the scene system, and it doesn't help anyone switching profiles outside of a scene load operation.

I'm experimenting with ways to manually activate the module from within the input system, but this is tricky because we have to work around the event system's life-cycle. I'm passing this off to @davidkline-ms, who's already doing active profile switching work.

Related: #4289

I wonder if this is also the root cause of #5887.

@davidkline-ms and @Railboy, when you get this issue fixed locally, can you follow the repro steps in #5887 and see if it resolves that issue as well?

Not a regression from 2.0, @cre8ivepark removed UnityUI from the examples hub for this reason. Removing release blocker.

I have a hacky 'fix' here. More of a partial investigation. It shows what functions need to be called to get it working again after switching scenes. But I haven't figured out when to do those things. As in, what event or where in code should I trigger the execution of those things.

https://github.com/AdamMitchell-ms/MixedRealityToolkit-Unity/commit/7a8a7d4c5481f6926f97554bb7e74bf92e847609

@AdamMitchell-ms Have you checked in your "hack"? What does your hack involve? I just tested the latest and the UI elements still don't seem to work.

@AdamMitchell-ms Have you checked in your "hack"? What does your hack involve? I just tested the latest and the UI elements still don't seem to work.

+1. Adam if you could please share your workaround then perhaps somebody can take it over / look further. Thank you so much for investigating!

@sostel and @julenka,

I've dropped this investigation and don't have time to pursue it at this time. But here are my changes if someone wants to pick them up.

https://github.com/AdamMitchell-ms/MixedRealityToolkit-Unity/commit/7a8a7d4c5481f6926f97554bb7e74bf92e847609

With those changes, after switching scenes, I would add an InputModuleReactivate anywhere in the scene, which would then call MixedRealityInputModule.Reactivate(). Then Unity UI input would work again.

The next steps would be determine when to call this properly. We'd need to find an event or function that fires at the right time to call it. You can see I had tried a few places in my changes, but none of them had worked yet.

when switching profiles, the pointing ray is going through the unity ui panel. it is as if the panel has lost it's layer or something similar

Will Unity UI continue to be supported moving forward? I ask because besides running into this issue myself, this porting guide suggests "Rebuild canvas-based UI with quads, colliders, and TextMeshPro text". Sometimes we just need a simple flat button UI without all the added bells and whistles (themes, 3d animations, multiple interaction types, etc).

This issue has been marked as stale by an automated process because it has not had any recent activity. It will be automatically closed in 30 days if no further activity occurs. If this is still an issue please add a new comment with more recent details and repro steps.

Was this page helpful?
0 / 5 - 0 ratings