Beispiel #1
0
    /**
     * Handles clicks on VR toggle
     * This function is used instead of OnValueChanged because the toggle state is reset whenever scenes change
     */
    protected override void OnToggleClick()
    {
        enableVR = !enableVR;
        if (enableVR)
        {
            StartCoroutine((EnableXR.SwitchToVR()));
        }

        else
        {
            StartCoroutine(EnableXR.SwitchTo2D());
        }
    }
Beispiel #2
0
    IEnumerator Start()
    {
        // Does not seem to work on Android. Authorization must be done manually
        yield return(Application.RequestUserAuthorization(UserAuthorization.WebCam));

        if (!Application.HasUserAuthorization(UserAuthorization.WebCam))
        {
            TopBarText.text = CheckAuthorization;
        }

        UpdateButtons();
        ActionsButtons = new List <Button>()
        {
            StereoRenderingButton, QuickStereoButton, CancelAllButton
        };
        ShowActionButtons(false);
        WebCamDevice[] devices = WebCamTexture.devices;

        // No camera detected
        if (devices.Length == 0)
        {
            Debug.Log("No camera detected");
            _frontCamAvailable = false;
            _backCamAvailable  = false;
        }

        else
        {
            if (FindCamera(devices))
            {
                // Priority to back cam
                _currentCam = _backCamAvailable ? _backCam : _frontCam;
                _currentCam.Play();
                Background.texture = _currentCam;
            }


            else
            {
                Debug.Log("Unable to find camera");
                TopBarText.text = UnableFindCam;
            }

            StartCoroutine(EnableXR.SwitchTo2D());
        }
    }