WebCamTexture Fail - black screen

Good Day,

I have problem with WebCamTexture. When i hit play for the first time its showing video on rawImage as it should, but when i go to another scene ( on play mode ) and back again its showing black screen or another image. When i go to edit mode and back to play screen is still black. Where can be the problem? In attachments you can see what i have.

Im checking if camera is connected and it is every time.
Unity 5.3.3f

public void StartCamera()
{
rawimage = transform.GetComponent<RawImage>();

WebCamDevice[] devices = WebCamTexture.devices;
WebCamTexture webcamTexture = new WebCamTexture();

foreach(WebCamDevice cam in devices){

  if(cam.isFrontFacing){
  webcamTexture.deviceName=cam.name;
  }
}
Debug.Log(webcamTexture.deviceName);

webcamTexture.Play();
rawimage.texture = webcamTexture;
rawimage.material.mainTexture = webcamTexture;
}


i Found the sollution… Maybe some1 will need it. I didnt stop the camera before i jumped to another scene.

webcamTexture.Stop();
2 Likes