- Home /
How can i find max resolution for WebCamTexture
Hi,
I'm having problems with créate a webCamTexture.
How can i find the resolution of a webcam before to créate the "new WebCamTexture(Width, Heigth, FPS) ??
thanks!
Answer by Graham-Dunnett · Oct 14, 2013 at 10:57 AM
Create the WebCam texture using the resolution you want. If that is bigger than the webcam supports, then the size you get will be the size the webcam supports.
Well, I'm using 4.3.4 right now, and I'm trying to set my WebCamTexture at a 4096 x 4096 size, and it results in a 4k texture that is extremely slow, but not the real size of my iSight... Furthermore, when I use Debug.Log (webcamtexture.width), I get 16 no matter the size it really is. I can check the size of generated texture in the inspector.
if the width is 16, that may mean that your webcam texture is not playing yet. (you need to call Play to start the camera)
Answer by RDC · Jun 24, 2014 at 09:10 AM
You may try set 1280X720P , exact what Unity supporting. Below is the code snip I am using, and working fine with me.
webcamTexture = new WebCamTexture (WebCamTexture.devices [0].name, 1280, 720, 30);
guiTexture.texture = webcamTexture;
webcamTexture.Play ();