General case, we can use these scripts below to display camera on the scene in the Unity3d.
WebCamTexture wc = new WebCamTexture ();
GameObject.Find (“/plane”).renderer.material.mainTexture = wc;
But sometimes we want to save camera to image, or realized video streaming. We can use WebcamTexture.GetPixels() and Texture2D.SetPixels(), but you must noticed returning width and height.
WebcamTexture construct can give requested width and height parameters. The issue occur when the parameters does not be supported by the chosen camera.
WebCamTexture wc = new WebCamTexture (160, 120);
Texture2D t = new Texture2D(wc.width, wc.height);
On the Android, above scripts can worked fine, but on the iPhone 5S that texture t just showing blur. The reason is even iphone camera doesn’t suport requested width and height, the property width and height of WebCamTexture still returning requested values instead real values of camera.
So the simplest solution is using WebCamTexture() to replace WebCamTexture(160, 120). At last, I made an easy sample here. Please feel free to download and comment anything.
Unity – Scripting API: WebCamTexture