Skip to content

Commit

Permalink
webcam may fail to start
Browse files Browse the repository at this point in the history
  • Loading branch information
homuler committed Aug 27, 2021
1 parent 78e6fe8 commit 9cba17c
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,14 @@ void InitializeWebCamTexture() {
}

IEnumerator WaitForWebCamTexture() {
yield return new WaitUntil(() => webCamTexture.width > 16);
const int timeoutFrame = 500;
var count = 0;
Logger.LogVerbose("Waiting for WebCamTexture to start");
yield return new WaitUntil(() => count++ > timeoutFrame || webCamTexture.width > 16);

if (webCamTexture.width <= 16) {
throw new TimeoutException("Failed to start WebCam");
}
}
}
}

0 comments on commit 9cba17c

Please sign in to comment.