- Home /
Display webcamtexture via sprite.texture, error at GetPixels(). Help :)
Hi guys,
I'm currently trying to get the camera feed and display onto the scene using sprite.texture. However, I'm stuck with an error at webCamTexture.GetPixels();. The error during runtime, when the function is called.
below is the error and a snippet of my code, please help thanks!!! :)
Error:
Texture rectangle is out of bounds (0 + 16 > 0)
UnityEngine.WebCamTexture:GetPixels(Int32, Int32, Int32, Int32)
Texture2D disp = new Texture2D(webCamTexture.width, webCamTexture.height, TextureFormat.ARGB32, false);
Color [] output = webCamTexture.GetPixels();//0, 0, disp.width, disp.height);
disp.SetPixels(output);
disp.Apply();
Answer by Spidlee · Aug 17, 2014 at 03:45 PM
Update: I resolved my "being stuck", via an alternate solution. I used quads to display the output instead of using sprite. Unfortunately, don't remember why I was getting the error with GetPixels. Probably to do with a bad initialisation of the webcamtexture or something.
Your answer
Follow this Question
Related Questions
Something Wrong With My Script 0 Answers
Webcam GetPixels is only returning black 1 Answer
Another Null Reference Exception 0 Answers
How to make a WebCamTexture 'run'? 0 Answers