Quantcast
Channel: Questions in topic: "webcam"
Viewing all articles
Browse latest Browse all 256

WebCamTexture nullpointerexception

$
0
0
I am trying to build an app which uses webcam. I am applying the webCamTexture on a raw image. I am trying to run this on webGL. I have done all the fact checks and applied all the safety checks. public RawImage rawimage; void Start () { WebCamDevice backCameraDevice; Debug.Log("code started"); WebCamDevice[] devices = WebCamTexture.devices; for (int i = 0; i < devices.Length; i++) Debug.Log(devices[i].name); if (WebCamTexture.devices.Length == 0) { Debug.Log("No devices cameras found"); return; } backCameraDevice = WebCamTexture.devices[0]; Debug.Log(backCameraDevice.name); WebCamTexture webcamTexture = new WebCamTexture(backCameraDevice.name); webcamTexture.requestedWidth = 150; webcamTexture.requestedHeight = 150; rawimage.texture = webcamTexture; rawimage.material.mainTexture = webcamTexture; webcamTexture.Play(); } I am getting a null pointer exception when I try to run this. Any help would be great. Please let me know how can I provide more information if needed

Viewing all articles
Browse latest Browse all 256

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>