Skip to content

Commit 2e68f68

Browse files
committed
Improve clientkit attempts to stop.
1 parent 8a9d7ff commit 2e68f68

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

OSVR-Unity/Assets/OSVRUnity/src/ClientKit.cs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,24 @@ void FixedUpdate()
8282
contextObject.update();
8383
}
8484

85+
void Stop()
86+
{
87+
if (null != contextObject)
88+
{
89+
Debug.Log("Shutting down OSVR.");
90+
contextObject.Dispose();
91+
contextObject = null;
92+
}
93+
}
94+
8595
void OnDestroy()
8696
{
87-
Debug.Log("Shutting down OSVR.");
88-
contextObject.Dispose ();
89-
contextObject = null;
97+
Stop();
98+
}
99+
100+
void OnApplicationQuit()
101+
{
102+
Stop();
90103
}
91104
}
92105
}

0 commit comments

Comments
 (0)