microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6k stars 2.12k forks source link

Add warnings when services with active listeners get destroyed #5116

Closed lukastoenneMS closed 9 months ago

lukastoenneMS commented 5 years ago

Describe the problem

MRTK services can get destroyed at runtime, removing event listeners etc. Similarly services can get created at runtime after components that use them. Even if components check for a service on Start/Awake/Enable, that service may be removed and recreated later, leaving a dysfunctional component.

Example:

During tests we create a scene with a camera and a MixedRealityInputModule on it (for piping events to the Unity event system). Between tests the event system service is torn down and recreated for the next test, which leaves a broken input module that will not receive source state events any longer.

The fix for this is to destroy the input module at the end of each test and recreate it for the next. But this kind of problem is easy to produce and hard to detect.

Describe the solution you'd like

There should be a debug more and/or test where services print warnings when they are destroyed while listeners are still registered. That way we at least know when components may be broken.

IssueSyncBot commented 9 months ago

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!