protected void LoadCamera(IVR vr, CameraSettingsSO cameraSettings, string cameraJsonSettings = null)
        {
            if(cameraJsonSettings == null)
            {
                cameraJsonSettings =
                    @"{""clearFlags"":""Skybox"",""backgroundColor"":[0.13,0.15,0.2,0.01],""depth"":-1,""clearFlags"":""Skybox"",""textureResourcesName"":""Skybox/Skybox""}";
            }
            var cameraPrefab = Resources.Load<VRCameraFactory>("Camera");

            var cameraGOInstance = Object.Instantiate(cameraPrefab.gameObject) as GameObject;
            //make sure this doesn't end up in the scene perm
            //VRCameraFactory.SetHideflagsRecursive(cameraGOInstance, HideFlags.DontSave | HideFlags.DontSaveInEditor | HideFlags.DontSaveInBuild);

            var cameraFactory = cameraGOInstance.GetComponent<VRCameraFactory>();
            var cursorController = cameraGOInstance.GetComponent<CursorController>();
            var fadeCube = cameraGOInstance.GetComponentInChildren<FadeSphere>();

            cameraFactory.SetCameraSettingsSO(cameraSettings);

            injectionBinder.Bind<CursorController>().ToValue(cursorController);
            injectionBinder.Bind<FadeSphere>().ToValue(fadeCube);
            injectionBinder.Bind<VRCameraFactory>().ToValue(cameraFactory);
            injectionBinder.GetBinding<IVR>().ToSingleton(); //let's see if this fixes the IVR being imported as a factory...
            cameraFactory.enabled = true;
            var serializedCamera = cameraJsonSettings.JsonDeserialize<SerializedCameraSettings>();
            cameraFactory.SetCameraSettingsOnAllCameras(serializedCamera);
            if(serializedCamera.customCameraSettings != null)
                vr.SetCustomCameraSettings(serializedCamera.customCameraSettings);
            //cameraPrefab.enabled = true;
        }
Beispiel #2
0
 public void SetCameraSettingsSO(CameraSettingsSO runtime)
 {
     RuntimeCameraToUse = runtime;
     createCamera();
 }