MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

UI Raycast Camera can be destroyed at runtime with a multi-scene-setup

Open Connor-Kerwin opened this issue 6 years ago • 6 comments

Describe the bug

There is no recovery from the UIRaycastCamera being destroyed at runtime. Due to the camera being spawned within the active scene, it doesn't guarantee the camera exists within the same scene as the core MRTK objects.

To reproduce

Steps to reproduce the behavior:

  1. Run Unity with an empty scene.
  2. Load a scene [Additive] with the core MRTK objects within it.
  3. The UIRaycastCamera is instantiated into the active scene (the empty scene).
  4. Unload the active scene (the empty one).
  5. MixedRealityInputModule throws exceptions because the camera is destroyed.

Expected behavior

The UIRaycastCamera should persist by either using DontDestroyOnLoad or being moved to the scene where the core MRTK objects exist.

Your setup (please complete the following information)

  • Unity Version 2019.3.4f1
  • MRTK Version 2.4.0

Target platform (please complete the following information)

  • HoloLens 2

Connor-Kerwin avatar Jun 03 '20 10:06 Connor-Kerwin

@Railboy I think that this is part of what the scene system that you added was intended to solve

wiwei avatar Jun 03 '20 16:06 wiwei

I seem to hit this now when I have upgraded to MRTK 2.4.0 (from 2.3.0, following the upgrade guide). I use the LoadAdditiveScene script from one of the examples (think it was included in one of the eye tracking exmaples). Directly on load for the new scene the Camera seems to be destroyed and it's spitting out errors. Attached a file containing the three repeating errors' stack traces separated by some newlines, they can maybe help.

Stack_traces.txt

c11epm avatar Jun 18 '20 09:06 c11epm

This seemed to solve itself by removing the MixedRealityToolkit and camera parent and reapply it with the MRTK tool Add to scene and configure...

c11epm avatar Jun 22 '20 11:06 c11epm

I've had an issue like this when using additive scenes in the editor with the Scene Manager System. You have to select DefaultManagerScene as the active scene. The problem is UIRaycastCamera always instantiates in the active scene.

sabvente avatar Dec 13 '20 22:12 sabvente

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.

stale[bot] avatar Apr 18 '22 15:04 stale[bot]

We appreciate your feedback and thank you for reporting this issue.

Microsoft Mixed Reality Toolkit version 2 (MRTK2) is currently in limited support. This means that Microsoft is only fixing high priority security issues. Unfortunately, this issue does not meet the necessary priority and will be closed. If you strongly feel that this issue deserves more attention, please open a new issue and explain why it is important.

Microsoft recommends that all new HoloLens 2 Unity applications use MRTK3 instead of MRTK2.

Please note that MRTK3 was released in August 2023. It features an all-new architecture for developing rich mixed reality experiences and has a minimum requirement of Unity 2021.3 LTS. For more information about MRTK3, please visit https://www.mixedrealitytoolkit.org.

Thank you for your continued support of the Mixed Reality Toolkit!

IssueSyncBot avatar Jan 13 '24 01:01 IssueSyncBot