Skip to content

Commit

Permalink
Stop() before Destroy() plus a null check
Browse files Browse the repository at this point in the history
  • Loading branch information
andybak committed Aug 1, 2023
1 parent ac5e2e4 commit 2f96096
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Assets/Scripts/WebcamSurface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,11 @@ private void UpdateButtonState()
private void OnDestroy()
{
#if !UNITY_ANDROID
_webcam.Stop();
Destroy(_webcam);
if (_webcam != null)
{
_webcam.Stop();
Destroy(_webcam);
}
#endif
}

Expand Down

0 comments on commit 2f96096

Please sign in to comment.