From b80ff7037e4fd95195d730518e2ba1dcbae1cabf Mon Sep 17 00:00:00 2001 From: Kurtis Date: Wed, 21 Nov 2018 11:42:07 -0800 Subject: [PATCH] Properly cleanup controller gameobjects in OnDestroy --- .../Input/Scripts/Utilities/MotionControllerVisualizer.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Assets/HoloToolkit/Input/Scripts/Utilities/MotionControllerVisualizer.cs b/Assets/HoloToolkit/Input/Scripts/Utilities/MotionControllerVisualizer.cs index 87699ac6c00..6b497ab7227 100644 --- a/Assets/HoloToolkit/Input/Scripts/Utilities/MotionControllerVisualizer.cs +++ b/Assets/HoloToolkit/Input/Scripts/Utilities/MotionControllerVisualizer.cs @@ -108,6 +108,11 @@ protected override void OnDestroy() InteractionManager.InteractionSourceDetected -= InteractionManager_InteractionSourceDetected; InteractionManager.InteractionSourceLost -= InteractionManager_InteractionSourceLost; Application.onBeforeRender -= Application_onBeforeRender; + + foreach (MotionControllerInfo controllerInfo in controllerDictionary.Values) + { + Destroy(controllerInfo.ControllerParent); + } #endif }