public override void OnInspectorGUI() { DrawDefaultInspector(); if (!CameraPreview.IsOpen) { if (GUILayout.Button(OPEN_MESSAGE)) { CameraPreview window = (CameraPreview)EditorWindow.GetWindow(typeof(CameraPreview)); window.Create(); window.camera = o.GetComponent <Camera>(); window.Show(); } } else { if (GUILayout.Button(CLOSE_MESSAGE)) { CameraPreview window = (CameraPreview)EditorWindow.GetWindow(typeof(CameraPreview)); window.Close(); } GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1)); previewMode = (PREVIEW_MODE)EditorGUILayout.EnumPopup("Preview mode", previewMode); if (previewMode == PREVIEW_MODE.WINDOWED) { CameraPreview.customResolution = EditorGUILayout.Vector2Field("Custom resolution", CameraPreview.customResolution); } EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Apply")) { CameraPreview.SetGameWindow(previewMode == PREVIEW_MODE.FULLSCREEN); } EditorGUILayout.EndHorizontal(); } /***** Uncomment to watch the lights taken in forward mode ****/ /* * for(int i = 0; i < screen.numberPointLights; i++) * { * TextureOverlay.PointLight p = screen.pointLights[i]; * EditorGUILayout.LabelField("Point light : pos " + p.position + "|| range " + p.range); * } * * for (int i = 0; i < screen.numberSpotLights; i++) * { * TextureOverlay.SpotLight p = screen.spotLights[i]; * EditorGUILayout.LabelField("Spot light : pos " + p.position + " || direction" + p.direction); * } */ }
public override void OnInspectorGUI() { DrawDefaultInspector(); if (!CameraPreview.IsOpen) { if (GUILayout.Button(OPEN_MESSAGE)) { CameraPreview window = (CameraPreview)EditorWindow.GetWindow(typeof(CameraPreview)); boost = PlayerSettings.colorSpace == ColorSpace.Linear; window.Create(); window.camera = o.GetComponent <Camera>(); window.Show(); CameraPreview.Boost(boost); } } else { if (GUILayout.Button(CLOSE_MESSAGE)) { CameraPreview window = (CameraPreview)EditorWindow.GetWindow(typeof(CameraPreview)); window.Close(); } EditorGUI.BeginChangeCheck(); GUIContent content = new GUIContent("Gamma Correction", "Correct the gamma color applied by the HMD"); boost = EditorGUILayout.Toggle(content, boost); CameraPreview.Boost(boost); if (EditorGUI.EndChangeCheck()) { CameraPreview.Boost(boost); } EditorGUI.BeginChangeCheck(); content = new GUIContent("Full Screen", "Press escape to exit full screen mode"); CameraPreview.isFullScreen = EditorGUILayout.Toggle(content, CameraPreview.isFullScreen); if (EditorGUI.EndChangeCheck()) { if (CameraPreview.isFullScreen) { CameraPreview.FullScreenGameWindow(); } else { CameraPreview.CloseGameWindow(); } } } }