Reputation: 1692
I am running a very simple script to access the camera. It works with the webcam on my laptop but it gives me a white screen when I run it on my iPhone
public class CameraController : MonoBehaviour {
public WebCamTexture mCamera = null;
public GameObject plane;
// Use this for initialization
void Start ()
{
Application.RequestUserAuthorization(UserAuthorization.WebCam);
Debug.Log ("Script has been started");
plane = GameObject.FindWithTag ("Player");
mCamera = new WebCamTexture ();
plane.GetComponent<Renderer>().material.mainTexture = mCamera;
mCamera.Play ();
}
// Update is called once per frame
void Update () {
}
}
When I build and run, Unity fires up XCode, where I also update info.plist so it asks for permission to access the camera
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) camera use</string>
Upvotes: 0
Views: 1953
Reputation: 511
Try this solution (this help):
http://answers.unity3d.com/questions/706142/openstart-device-camera-in-unity3d-app-using-c-scr.html
Upvotes: 1