private IEnumerator Start()
    {
        // ボタンは最初は非表示
        changeBtnVisible(false);

        if (WebCamTexture.devices.Length == 0)
        {
            Debug.LogFormat("カメラがありません。");
            yield break;
        }

        yield return(Application.RequestUserAuthorization(UserAuthorization.WebCam));

        if (!Application.HasUserAuthorization(UserAuthorization.WebCam))
        {
            Debug.LogFormat("カメラ利用が許可されていません。");
            yield break;
        }

        WebCamDevice userCameraDevice = WebCamTexture.devices[0];

        webcamTexture = new WebCamTexture(userCameraDevice.name, width, height);
        //webcamTexture = new WebCamTexture(userCameraDevice.name);

        cameraPanel.texture = webcamTexture;
        webcamTexture.Play();

        Debug.Log(webcamTexture.width + " " + webcamTexture.height + " " + webcamTexture.requestedFPS);

        // バーコードリーダーのセット
        this.reader = new WebcamCodeReader();
    }
Exemple #2
0
    void Start()
    {
        //Planeのレンダラー
        Renderer renderer = GetComponent <Renderer>();

        webCamTexture = new WebCamTexture();

        //mainTextureにWebCamTextureを指定する
        renderer.material.mainTexture = webCamTexture;
        webCamTexture.Play();

        qr_reader = new WebcamCodeReader();
    }