Esempio n. 1
0
    void Start()
    {
        WebCamDevice[] camDevices = WebCamTexture.devices;

        if (camDevices.Length == 0)
        {
            Debug.LogWarning("No Cameras Available");
            return;
        }

        SetUpWebCam();

        if (!WebCam)
        {
            useFrontCamera = !useFrontCamera;
        }

        SetUpWebCam();

        if (!WebCam)
        {
            Debug.LogWarning("No Front Camera");
            return;
        }

        fitter.aspectMode = aspectMode;
        WebCam.Play();
        background.texture = WebCam;
        WebcamSize         = new Vector2Int(WebCam.width, WebCam.height);
    }
Esempio n. 2
0
    IEnumerator Start()
    {
        WebCamDevice[] camDevices = WebCamTexture.devices;

        if (camDevices.Length == 0)
        {
            Debug.LogWarning("No Cameras Available");
            yield break;
        }

        SetUpWebCam();

        if (!WebCam)
        {
            useFrontCamera = !useFrontCamera;
            SetUpWebCam();
        }

        if (!WebCam)
        {
            Debug.LogWarning("No Front Camera");
            yield break;
        }

        WebCam.Play();

        yield return(new WaitUntil(() => WebCam.didUpdateThisFrame));

        Debug.LogWarning("Web Cam Loaded");

        fitter.aspectMode  = aspectMode;
        WebCamRatio        = WebCam.width / (float)WebCam.height;
        background.texture = WebCam;
        Debug.LogWarning("Web Cam Ratio: " + WebCamRatio);

        CamStreamLoaded = true;
    }
 public void Play()
 {
     WebCam.Play();
 }