2016-11-05 17 views
0

我正在運行一個非常簡單的腳本來訪問攝像頭。它與我的筆記本電腦攝像頭,但它給了我,當我在我的iPhone上運行它與Unity一起運行時無法在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() { 
    } 
} 

當我建立和運行,統一觸發了的XCode,所以它要求在那裏我還更新的info.plist白屏是否允許訪問攝像機

<key>NSCameraUsageDescription</key> 
<string>$(PRODUCT_NAME) camera use</string> 

回答

相關問題