File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Assets/MRTK/Core/Utilities/SceneContent Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ private enum AlignmentType
35
35
36
36
private Vector3 contentPosition = Vector3 . zero ;
37
37
private const uint MaxEditorFrameWaitCount = 5 ;
38
+ private Coroutine initializeSceneContentWithDelay ;
38
39
39
40
private void Awake ( )
40
41
{
@@ -44,7 +45,15 @@ private void Awake()
44
45
}
45
46
46
47
// Init the content height on non-XR platforms
47
- StartCoroutine ( InitializeSceneContentWithDelay ( ) ) ;
48
+ initializeSceneContentWithDelay = StartCoroutine ( InitializeSceneContentWithDelay ( ) ) ;
49
+ }
50
+
51
+ private void OnDestroy ( )
52
+ {
53
+ if ( initializeSceneContentWithDelay != null )
54
+ {
55
+ StopCoroutine ( initializeSceneContentWithDelay ) ;
56
+ }
48
57
}
49
58
50
59
// Not waiting often caused the camera's position to be incorrect at this point. This seems like a Unity bug.
@@ -64,6 +73,8 @@ private IEnumerator InitializeSceneContentWithDelay()
64
73
}
65
74
66
75
InitializeSceneContent ( ) ;
76
+
77
+ initializeSceneContentWithDelay = null ;
67
78
}
68
79
69
80
You can’t perform that action at this time.
0 commit comments