Skip to content

Commit 8674de9

Browse files
author
David Kline
authored
Merge pull request #2377 from StephenHodgson/MRTK-vNEXT-RaycastCameraCleanup
properly cleanup ui raycast camera when we disable input system.
2 parents 381cb14 + 36a91d1 commit 8674de9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Assets/MixedRealityToolkit/InputSystem/MixedRealityInputManager.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,18 @@ public override void Destroy()
166166
{
167167
InputDisabled?.Invoke();
168168

169+
if (FocusProvider.UIRaycastCamera != null)
170+
{
171+
if (Application.isEditor)
172+
{
173+
UnityEngine.Object.DestroyImmediate(FocusProvider.UIRaycastCamera.gameObject);
174+
}
175+
else
176+
{
177+
UnityEngine.Object.Destroy(FocusProvider.UIRaycastCamera.gameObject);
178+
}
179+
}
180+
169181
if (focusProvider != null)
170182
{
171183
focusProvider.enabled = false;

0 commit comments

Comments
 (0)