Quantcast
Channel: Questions in topic: "exception"
Viewing all articles
Browse latest Browse all 470

Webcam texture exception handling

$
0
0
Hi Guys, I'm doing project in which I use webcam to take user's photo. In this if webcam is used by other application or not found it throws exception and some weird things happen. I want to check if exception has been thrown. I tried using try...catch clause but it didn't work. Anybody knows how to do it? Below is my code. var error : TextMesh; function Start () { try { var webcamTexture : WebCamTexture = WebCamTexture(); if( !webcamTexture.isPlaying) { renderer.material.mainTexture = webcamTexture; webcamTexture.Play(); print(" texture play"); } else error.text = " Camera not found or other application is using camera"; // Debug.Log(webcamTexture.isPlaying); } catch( err : System.Exception) { error.text = err.Message; print("from catch"); } }

Viewing all articles
Browse latest Browse all 470

Trending Articles