Ejemplo n.º 1
0
 public void PrintCameraSettings()
 {
     var camera = _currentCamera.GetComponentInChildren<Camera>();
     var settings = new SerializedCameraSettings
     {
         clearFlags = camera.clearFlags,
         depth = camera.depth,
         farClipPlane = camera.farClipPlane
         //fieldOfView = camera.fieldOfView
     };
     settings.SaveCameraBackgroundColor(camera.backgroundColor);
     Debug.Log(settings.JsonSerialize());
 }
Ejemplo n.º 2
0
        public static void SetCameraSettingsOnAllCameras(SerializedCameraSettings settings, GameObject parent)
        {
            var cameras = parent.GetComponentsInChildren<Camera>();
            foreach(var vrcamera in cameras)
            {
                if(settings.backgroundColor != null)
                    vrcamera.backgroundColor = settings.getCameraBackgroundColor();
                vrcamera.clearFlags = settings.clearFlags;
                if(settings.farClipPlane > 0)
                {
                    vrcamera.farClipPlane = settings.farClipPlane;
                    //NOTE: almost every camera type seems to hard error whith this set to zero, so I don't dtho that for sure in code.  was the last but at ggj
                }

                if(settings.clearFlags == CameraClearFlags.Skybox && !string.IsNullOrEmpty(settings.textureResourcesName))
                {
                    var skyboxMat = Resources.Load<Material>(settings.textureResourcesName);
                    var newSB = vrcamera.gameObject.AddComponent<Skybox>();
                    newSB.material = skyboxMat;
                }

                //camera.fieldOfView = settings.fieldOfView;
            }
        }