/// <summary>
        /// Set linear deffered lighting (the best for outdoor scenes)
        /// </summary>
        /// <param name="ambientSkiesEditor"></param>
        public static void SetLinearDeferredLighting(AmbientSkiesEditorWindow ambientSkiesEditor)
        {
            if (ambientSkiesEditor != null)
            {
                ambientSkiesEditor.Close();
            }

            PlayerSettings.colorSpace = ColorSpace.Linear;
#if UNITY_5_5_OR_NEWER
            var tier1 = EditorGraphicsSettings.GetTierSettings(EditorUserBuildSettings.selectedBuildTargetGroup, GraphicsTier.Tier1);
            tier1.renderingPath = RenderingPath.DeferredShading;
            EditorGraphicsSettings.SetTierSettings(EditorUserBuildSettings.selectedBuildTargetGroup, GraphicsTier.Tier1, tier1);
            var tier2 = EditorGraphicsSettings.GetTierSettings(EditorUserBuildSettings.selectedBuildTargetGroup, GraphicsTier.Tier2);
            tier2.renderingPath = RenderingPath.DeferredShading;
            EditorGraphicsSettings.SetTierSettings(EditorUserBuildSettings.selectedBuildTargetGroup, GraphicsTier.Tier2, tier2);
            var tier3 = EditorGraphicsSettings.GetTierSettings(EditorUserBuildSettings.selectedBuildTargetGroup, GraphicsTier.Tier3);
            tier3.renderingPath = RenderingPath.DeferredShading;
            EditorGraphicsSettings.SetTierSettings(EditorUserBuildSettings.selectedBuildTargetGroup, GraphicsTier.Tier3, tier3);
#else
            PlayerSettings.renderingPath = RenderingPath.DeferredShading;
#endif
        }
Esempio n. 2
0
        public override void OnInspectorGUI()
        {
            m_profile = (AmbientSkyProfiles)target;
            if (m_profile != null)
            {
                string version = PWApp.CONF.Version;

                EditorGUI.BeginChangeCheck();

                Color defaultBackgroundColor = GUI.backgroundColor;
                Color notDefaultsSetColor    = Color.red;
                Color defaultsSetColor       = Color.green;

                EditorGUILayout.LabelField("Version: " + version);

                if (!CheckIfDefaultsSet())
                {
                    GUI.backgroundColor = notDefaultsSetColor;
                    if (GUILayout.Button("Revert To Factory Settings"))
                    {
                        if (EditorUtility.DisplayDialog("Warning!", "You are about to revert to factory settings. This will close the editor window if open, and reset Ambient Skies back to it's default installation settings. Doing this will overwrite your changes, are you sure you want to proceed?", "Yes", "No"))
                        {
                            AmbientSkiesEditorWindow editor = (AmbientSkiesEditorWindow)EditorWindow.GetWindow(typeof(AmbientSkiesEditorWindow));
                            if (editor != null)
                            {
                                editor.Close();
                            }
                            m_profile.RevertAllDefaults(m_profile.m_selectedRenderPipeline);
                        }
                    }
                }

                if (m_profile.m_editSettings)
                {
                    GUI.backgroundColor = defaultBackgroundColor;
                    DrawDefaultInspector();
                    if (GUILayout.Button("Save All Defaults"))
                    {
                        m_profile.SaveAllDefaults(m_profile.m_selectedRenderPipeline);
                    }
                }

                if (EditorGUI.EndChangeCheck())
                {
                    if (m_profile.m_editSettings)
                    {
                        //Make sure profile indexes are correct
                        for (int profileIdx = 0; profileIdx < m_profile.m_skyProfiles.Count; profileIdx++)
                        {
                            m_profile.m_skyProfiles[profileIdx].profileIndex = profileIdx;
                        }
                        //Make sure profile indexes are correct
                        for (int profileIdx = 0; profileIdx < m_profile.m_proceduralSkyProfiles.Count; profileIdx++)
                        {
                            m_profile.m_proceduralSkyProfiles[profileIdx].profileIndex = profileIdx;
                        }
                        //Make sure profile indexes are correct
                        for (int profileIdx = 0; profileIdx < m_profile.m_gradientSkyProfiles.Count; profileIdx++)
                        {
                            m_profile.m_gradientSkyProfiles[profileIdx].profileIndex = profileIdx;
                        }
                        for (int profileIdx = 0; profileIdx < m_profile.m_ppProfiles.Count; profileIdx++)
                        {
                            m_profile.m_ppProfiles[profileIdx].profileIndex = profileIdx;
                        }
                    }
                    EditorUtility.SetDirty(m_profile);
                }
            }
        }