private void Awake() { videoCamera = arSession.GetComponentInChildren <VideoCameraDevice>(); cameraRenderer = arSession.GetComponentInChildren <CameraImageRenderer>(); cubeTexture = CubeRenderer.material.mainTexture; targetTextureEventHandler = (camera, texture) => { if (texture) { CubeRenderer.material.mainTexture = texture; } else { CubeRenderer.material.mainTexture = cubeTexture; if (SystemInfo.graphicsDeviceType == UnityEngine.Rendering.GraphicsDeviceType.Metal) { CubeRenderer.transform.localScale = new Vector3(-1, -1, 1); } else { CubeRenderer.transform.localScale = new Vector3(1, 1, 1); } } }; videoCamera.DeviceOpened += () => { if (videoCamera.Device == null) { return; } var flip = videoCamera.Device.type() == CameraDeviceType.Front ? arSession.HorizontalFlipFront : arSession.HorizontalFlipNormal; FlipSwitch.isOn = flip == ARSession.ARHorizontalFlipMode.World; }; }
private void Awake() { videoCamera = arSession.GetComponentInChildren <VideoCameraDevice>(); cameraRenderer = arSession.GetComponentInChildren <CameraImageRenderer>(); cubeTexture = CubeRenderer.material.mainTexture; targetTextureEventHandler = (camera, texture) => { if (texture) { CubeRenderer.material.mainTexture = texture; } else { CubeRenderer.material.mainTexture = cubeTexture; CubeRenderer.transform.localScale = new Vector3(1, 1, 1); } }; videoCamera.DeviceOpened += () => { if (videoCamera.Device == null) { return; } var flip = videoCamera.Device.type() == CameraDeviceType.Front ? arSession.HorizontalFlipFront : arSession.HorizontalFlipNormal; FlipSwitch.isOn = flip == ARSession.ARHorizontalFlipMode.World; }; var launcher = "AllSamplesLauncher"; if (Application.CanStreamedLevelBeLoaded(launcher)) { var button = BackButton.GetComponent <Button>(); button.onClick.AddListener(() => { UnityEngine.SceneManagement.SceneManager.LoadScene(launcher); }); } else { BackButton.gameObject.SetActive(false); } }