static void ShowWindow()
        {
            // Load the PreviewSettings.
            PreviewSettings.LoadAsset();

            // Get existing open window or if none, make a new one:
            PreviewSettingsEditor window = (PreviewSettingsEditor)EditorWindow.GetWindow(typeof(PreviewSettingsEditor));

            // Focus on the window.
            window.Focus();
        }
        /// <summary>
        /// Raised after OnGUI is called.
        /// </summary>
        void OnGUI()
        {
            // Draw a label for the Preview Settings
            GUILayout.Label("Preview Settings", EditorStyles.boldLabel);

            EditorGUI.BeginChangeCheck();

            PreviewSettings.audio = EditorTools.DrawHeader("Audio Channel" + ChannelStatus(PreviewSettings.audio), "ps_audio");
            if (PreviewSettings.audio)
            {
                EditorTools.BeginContents();

                PreviewSettings.audioVolume = EditorGUILayout.Slider("Audio Volume", PreviewSettings.audioVolume, 0f, 1f);

                EditorTools.EndContents();
            }

            PreviewSettings.camera = EditorTools.DrawHeader("Camera Channel" + ChannelStatus(PreviewSettings.camera), "ps_camera");
            if (PreviewSettings.camera)
            {
                EditorTools.BeginContents();

                PreviewSettings.cameraFoV = EditorGUILayout.Slider("Field of View", PreviewSettings.cameraFoV, 1f, 179f);

                EditorGUILayout.PrefixLabel("Camera Clip Planes");
                EditorGUILayout.MinMaxSlider(ref PreviewSettings.cameraNearPlane, ref PreviewSettings.cameraFarPlane, 0f, 1000f);

                EditorGUILayout.BeginVertical();
                EditorGUILayout.BeginHorizontal();

                EditorGUILayout.PrefixLabel("Near");
                PreviewSettings.cameraNearPlane = EditorGUILayout.FloatField(PreviewSettings.cameraNearPlane);

                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();

                EditorGUILayout.PrefixLabel("Far");
                PreviewSettings.cameraFarPlane = EditorGUILayout.FloatField(PreviewSettings.cameraFarPlane);

                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();

                EditorTools.EndContents();
            }

            if (EditorGUI.EndChangeCheck())
            {
                PreviewSettings.SaveAsset();
            }
        }
 /// <summary>
 /// Raised after this Window is destroyed.
 /// </summary>
 void OnDestroy()
 {
     PreviewSettings.SaveAsset();
 }
 static void LoadAudioSettings()
 {
     PreviewSettings.SetAudioSource(Selection.activeGameObject.GetComponent <AudioSource>());
 }
 static void LoadCameraSettings()
 {
     PreviewSettings.SetCamera(Selection.activeGameObject.GetComponent <Camera>());
 }