Example #1
0
 void Start()
 {
     InitFileBrowser(FileType.Object);
     if (!XRSettings.enabled)
     {
         EnableXR.ResetCameras();
         StartCoroutine(EnableXR.SwitchToVR());
     }
 }
Example #2
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());
        }
    }
Example #3
0
        void Start()
        {
            if (!XRSettings.enabled)
            {
                EnableXR.ResetCameras();
                StartCoroutine(EnableXR.SwitchToVR());
            }

            // If textures were modified somewhere else (basically through the menu), updates them in the viewer
            if (_leftTexture != null && _rightTexture != null)
            {
                LeftImage.texture  = _leftTexture;
                RightImage.texture = _rightTexture;
            }
        }
Example #4
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());
        }
    }