BrowseURL() private method

private BrowseURL ( string url ) : void
url string
return void
示例#1
0
 private static void ComponentBasedWorkflowButton()
 {
     GUILayout.BeginHorizontal();
     if (EditorGUILayout.LinkLabel(s_Styles.m_LearnAboutComponent))
     {
         Help.BrowseURL("https://github.com/Unity-Technologies/NavMeshComponents");
     }
     GUILayout.EndHorizontal();
 }
示例#2
0
 private void ShowHelpPageOrBrowseURL(string url, string analyticsAction)
 {
     Analytics.Track(string.Format("/WelcomeScreen/OpenURL/{0}/{1}", analyticsAction, WelcomeScreen.s_ShowCount));
     if (url.StartsWith("file"))
     {
         Help.ShowHelpPage(url);
     }
     else if (url.StartsWith("home/"))
     {
         AssetStore.Open(url);
         GUIUtility.ExitGUI();
     }
     else
     {
         Help.BrowseURL(url);
     }
 }
示例#3
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


        void Information()
        {
            //--------------

            DrawUILine(bgLineColor, 2, bgLinePadding);
            if (GUILayout.Button("Description and Instructions"))
            {
                Help.BrowseURL("https://nvjob.github.io/unity/nvjob-stc-8");
            }
            if (GUILayout.Button("#NVJOB Store"))
            {
                Help.BrowseURL("https://nvjob.github.io/store/");
            }
            DrawUILine(bgLineColor, 2, bgLinePadding);

            //--------------
        }
示例#4
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


        void Information()
        {
            //--------------

            DrawUILine(bgLineColor, 2, bgLinePadding);
            if (GUILayout.Button("Download Examples"))
            {
                Help.BrowseURL("https://github.com/nvjob/stc7/archive/master.zip");
            }
            if (GUILayout.Button("Description and Instructions"))
            {
                Help.BrowseURL("https://nvjob.github.io/unity/nvjob-stc-7");
            }
            if (GUILayout.Button("Patrons and Donations"))
            {
                Help.BrowseURL("https://nvjob.github.io/patrons");
            }
            EditorGUILayout.TextArea("This asset exists only thanks to your donations. Help this asset and it will continue to exist and be updated.", EditorStyles.textArea);
            DrawUILine(bgLineColor, 2, bgLinePadding);

            //--------------
        }
        void ShowBuildTargetSettings()
        {
            EditorGUIUtility.labelWidth = Mathf.Min(180, (position.width - 265) * 0.47f);

            BuildTarget      buildTarget      = EditorUserBuildSettingsUtils.CalculateSelectedBuildTarget();
            BuildTargetGroup buildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup;
            BuildPlatform    platform         = BuildPlatforms.instance.BuildPlatformFromTargetGroup(buildTargetGroup);
            bool             licensed         = BuildPipeline.LicenseCheck(buildTarget);

            // Draw the group name
            GUILayout.Space(18);

            // Draw icon and text of title separately so we can control the space between them
            Rect r = GUILayoutUtility.GetRect(50, 36);

            r.x += 1;
            GUI.Label(new Rect(r.x + 3, r.y + 3, 32, 32), platform.title.image, GUIStyle.none);
            GUI.Toggle(r, false, platform.title.text, styles.platformSelector);

            GUILayout.Space(10);

            if (platform.targetGroup == BuildTargetGroup.WebGL && !BuildPipeline.IsBuildTargetSupported(platform.targetGroup, buildTarget))
            {
                if (IntPtr.Size == 4)
                {
                    GUILayout.Label("Building for WebGL requires a 64-bit Unity editor.");
                    GUIBuildButtons(false, false, false, platform);
                    return;
                }
            }

            string moduleName = Modules.ModuleManager.GetTargetStringFrom(buildTargetGroup, buildTarget);

            if (IsModuleNotInstalled(buildTargetGroup, buildTarget))
            {
                GUILayout.Label(EditorGUIUtility.TextContent(string.Format(styles.noModuleLoaded, BuildPlatforms.instance.GetModuleDisplayName(buildTargetGroup, buildTarget))));
                if (GUILayout.Button(styles.openDownloadPage, EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
                {
                    string url = GetPlaybackEngineDownloadURL(moduleName);
                    Help.BrowseURL(url);
                }
                GUIBuildButtons(false, false, false, platform);
                return;
            }
            else if (Application.HasProLicense() && !InternalEditorUtility.HasAdvancedLicenseOnBuildTarget(buildTarget))
            {
                // Show copy for using personal edition build targets with pro edition editor
                string infoText = string.Format(styles.infoText,
                                                BuildPlatforms.instance.GetBuildTargetDisplayName(buildTargetGroup, buildTarget));

                GUILayout.BeginVertical(EditorStyles.helpBox);
                GUILayout.Label(infoText, EditorStyles.wordWrappedMiniLabel);
                GUILayout.BeginHorizontal();
                if (GUILayout.Button(styles.eula, EditorStyles.miniButton))
                {
                    Application.OpenURL("http://unity3d.com/legal/eula");
                }
                if (GUILayout.Button(string.Format(styles.addToYourPro, BuildPlatforms.instance.GetBuildTargetDisplayName(buildTargetGroup, buildTarget)), EditorStyles.miniButton))
                {
                    Application.OpenURL("http://unity3d.com/get-unity");
                }
                GUILayout.EndHorizontal();
                GUILayout.EndVertical();
            }

            GUIContent error = styles.GetDownloadErrorForTarget(buildTarget);

            if (error != null)
            {
                GUILayout.Label(error, EditorStyles.wordWrappedLabel);
                GUIBuildButtons(false, false, false, platform);
                return;
            }

            // Draw not licensed buy now UI
            if (!licensed)
            {
                string niceName   = BuildPipeline.GetBuildTargetGroupDisplayName(buildTargetGroup);
                string licenseMsg = "Your license does not cover {0} Publishing.";
                string buttonMsg  = "Go to Our Online Store";
                if (BuildTargetDiscovery.PlatformHasFlag(buildTarget, TargetAttributes.IsConsole))
                {
                    licenseMsg += "Please see the {0} section of the Platform Module Installation documentation for more details.";
                    buttonMsg   = "Platform Module Installation";
                }
                else if (BuildTargetDiscovery.PlatformHasFlag(buildTarget, TargetAttributes.IsStandalonePlatform))
                {
                    buttonMsg = "";
                }

                GUIContent[] notLicensedMessage =
                {
                    EditorGUIUtility.TextContent(string.Format(L10n.Tr(licenseMsg), niceName)),
                    EditorGUIUtility.TextContent(L10n.Tr(buttonMsg)),
                    new GUIContent(styles.shopURL)
                };

                GUILayout.Label(notLicensedMessage[0], EditorStyles.wordWrappedLabel);
                GUILayout.Space(5);
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (notLicensedMessage[1].text.Length != 0)
                {
                    if (GUILayout.Button(notLicensedMessage[1]))
                    {
                        Application.OpenURL(notLicensedMessage[2].text);
                    }
                }
                GUILayout.EndHorizontal();
                GUIBuildButtons(false, false, false, platform);
                return;
            }

            // FIXME: WHY IS THIS ALL IN ONE FUNCTION?!
            // Draw the side bar to the right. Different options like specific Standalone player to build, profiling and debugging options, etc.
            string module = ModuleManager.GetTargetStringFrom(platform.targetGroup, buildTarget);
            IBuildWindowExtension buildWindowExtension = ModuleManager.GetBuildWindowExtension(module);

            if (buildWindowExtension != null)
            {
                buildWindowExtension.ShowPlatformBuildOptions();
            }

            GUI.changed = false;
            GUI.enabled = true;

            bool enableBuildButton = buildWindowExtension != null?buildWindowExtension.EnabledBuildButton() : true;

            bool enableBuildAndRunButton = false;

            bool shouldDrawDebuggingToggle = buildWindowExtension != null?buildWindowExtension.ShouldDrawScriptDebuggingCheckbox() : true;

            bool shouldDrawExplicitNullChecksToggle = buildWindowExtension != null?buildWindowExtension.ShouldDrawExplicitNullCheckbox() : false;

            bool shouldDrawDivideByZeroChecksToggle = buildWindowExtension != null?buildWindowExtension.ShouldDrawExplicitDivideByZeroCheckbox() : false;

            bool shouldDrawArrayBoundsChecksToggle = buildWindowExtension != null?buildWindowExtension.ShouldDrawExplicitArrayBoundsCheckbox() : false;

            bool shouldDrawDevelopmentPlayerToggle = buildWindowExtension != null?buildWindowExtension.ShouldDrawDevelopmentPlayerCheckbox() : true;

            IBuildPostprocessor postprocessor = ModuleManager.GetBuildPostProcessor(buildTargetGroup, buildTarget);
            bool enableBuildScriptsOnly       = (postprocessor != null ? postprocessor.SupportsScriptsOnlyBuild() : false);
            bool canInstallInBuildFolder      = false;

            if (BuildPipeline.IsBuildTargetSupported(buildTargetGroup, buildTarget))
            {
                bool shouldDrawConnectProfilerToggle = buildWindowExtension != null?buildWindowExtension.ShouldDrawProfilerCheckbox() : true;

                GUI.enabled = shouldDrawDevelopmentPlayerToggle;
                if (shouldDrawDevelopmentPlayerToggle)
                {
                    EditorUserBuildSettings.development = EditorGUILayout.Toggle(styles.debugBuild, EditorUserBuildSettings.development);
                }

                bool developmentBuild = EditorUserBuildSettings.development;

                GUI.enabled = developmentBuild;

                if (shouldDrawConnectProfilerToggle)
                {
                    if (!GUI.enabled)
                    {
                        if (!developmentBuild)
                        {
                            styles.profileBuild.tooltip = "Profiling only enabled in Development Player";
                        }
                    }
                    else
                    {
                        styles.profileBuild.tooltip = "";
                    }
                    EditorUserBuildSettings.connectProfiler = EditorGUILayout.Toggle(styles.profileBuild, EditorUserBuildSettings.connectProfiler);
                }

                GUI.enabled = developmentBuild;
                if (shouldDrawDebuggingToggle)
                {
                    using (new EditorGUI.DisabledScope(buildWindowExtension != null ? buildWindowExtension.ShouldDisableManagedDebuggerCheckboxes() : false))
                    {
                        EditorUserBuildSettings.allowDebugging = EditorGUILayout.Toggle(styles.allowDebugging, EditorUserBuildSettings.allowDebugging);

                        // Not all platforms have native dialog implemented in Runtime\Misc\GiveDebuggerChanceToAttachIfRequired.cpp
                        // Display this option only for developer builds
                        bool shouldDrawWaitForManagedDebugger = buildWindowExtension != null?buildWindowExtension.ShouldDrawWaitForManagedDebugger() : false;

                        if (EditorUserBuildSettings.allowDebugging && shouldDrawWaitForManagedDebugger)
                        {
                            var buildTargetName = BuildPipeline.GetBuildTargetName(buildTarget);

                            bool value = EditorGUILayout.Toggle(styles.waitForManagedDebugger, EditorUserBuildSettings.GetPlatformSettings(buildTargetName, kSettingDebuggingWaitForManagedDebugger) == "true");
                            EditorUserBuildSettings.SetPlatformSettings(buildTargetName, kSettingDebuggingWaitForManagedDebugger, value.ToString().ToLower());
                        }
                    }

                    if (EditorUserBuildSettings.allowDebugging && PlayerSettings.GetScriptingBackend(buildTargetGroup) == ScriptingImplementation.IL2CPP)
                    {
                        var  apiCompatibilityLevel = PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup);
                        bool isDebuggerUsable      = apiCompatibilityLevel == ApiCompatibilityLevel.NET_4_6 || apiCompatibilityLevel == ApiCompatibilityLevel.NET_Standard_2_0;

                        if (!isDebuggerUsable)
                        {
                            EditorGUILayout.HelpBox("Script debugging is only supported with IL2CPP on .NET 4.x and .NET Standard 2.0 API Compatibility Levels.", MessageType.Warning);
                        }
                    }
                }


                if (shouldDrawExplicitNullChecksToggle)
                {
                    // Force 'ExplicitNullChecks' to true if it's a development build.
                    GUI.enabled = !developmentBuild;
                    if (GUI.enabled == false)
                    {
                        EditorUserBuildSettings.explicitNullChecks = true;
                    }
                    EditorUserBuildSettings.explicitNullChecks = EditorGUILayout.Toggle(styles.explicitNullChecks, EditorUserBuildSettings.explicitNullChecks);
                    // Undo force from above
                    GUI.enabled = developmentBuild;
                }

                if (shouldDrawDivideByZeroChecksToggle)
                {
                    // Force 'explicitDivideByZeroChecks' to true if it's a development build.
                    GUI.enabled = !developmentBuild;
                    if (GUI.enabled == false)
                    {
                        EditorUserBuildSettings.explicitDivideByZeroChecks = true;
                    }
                    EditorUserBuildSettings.explicitDivideByZeroChecks = EditorGUILayout.Toggle(styles.explicitDivideByZeroChecks, EditorUserBuildSettings.explicitDivideByZeroChecks);
                    // Undo force from above
                    GUI.enabled = developmentBuild;
                }

                if (shouldDrawArrayBoundsChecksToggle)
                {
                    // Force 'explicitArrayBoundsChecks' to true if it's a development build.
                    GUI.enabled = !developmentBuild;
                    if (GUI.enabled == false)
                    {
                        EditorUserBuildSettings.explicitArrayBoundsChecks = true;
                    }
                    EditorUserBuildSettings.explicitArrayBoundsChecks = EditorGUILayout.Toggle(styles.explicitArrayBoundsChecks, EditorUserBuildSettings.explicitArrayBoundsChecks);
                    // Undo force from above
                    GUI.enabled = developmentBuild;
                }

                if (buildWindowExtension != null && enableBuildScriptsOnly)
                {
                    buildWindowExtension.DoScriptsOnlyGUI();
                }

                GUI.enabled = true;

                GUILayout.FlexibleSpace();

                if (postprocessor != null && postprocessor.SupportsLz4Compression())
                {
                    var cmpIdx = Array.IndexOf(styles.compressionTypes, EditorUserBuildSettings.GetCompressionType(buildTargetGroup));
                    if (cmpIdx == -1)
                    {
                        cmpIdx = 1; // Lz4 by default.
                    }
                    cmpIdx = EditorGUILayout.Popup(styles.compressionMethod, cmpIdx, styles.compressionStrings);
                    EditorUserBuildSettings.SetCompressionType(buildTargetGroup, styles.compressionTypes[cmpIdx]);
                }

                canInstallInBuildFolder = Unsupported.IsSourceBuild() && PostprocessBuildPlayer.SupportsInstallInBuildFolder(buildTargetGroup, buildTarget);

                if (enableBuildButton)
                {
                    enableBuildAndRunButton = buildWindowExtension != null?buildWindowExtension.EnabledBuildAndRunButton() &&
                                              !(EditorUserBuildSettings.installInBuildFolder) : !(EditorUserBuildSettings.installInBuildFolder);
                }
            }
            else
            {
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));

                GUILayout.BeginVertical(GUILayout.ExpandWidth(true));

                GUILayout.Label(string.Format(L10n.Tr("{0} is not supported in this build.\nDownload a build that supports it."), BuildPipeline.GetBuildTargetGroupDisplayName(buildTargetGroup)));

                GUILayout.EndVertical();
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }

            if (buildTarget == BuildTarget.Android)
            {
                AndroidPublishGUI();
            }

            GUIBuildButtons(buildWindowExtension, enableBuildButton, enableBuildAndRunButton,
                            canInstallInBuildFolder, platform);
        }
示例#6
0
 public void OnGUI()
 {
     EditorUpdateWindow.LoadResources();
     GUILayout.BeginVertical(new GUILayoutOption[0]);
     GUILayout.Space(10f);
     GUI.Box(new Rect(13f, 8f, (float)EditorUpdateWindow.s_UnityLogo.image.width, (float)EditorUpdateWindow.s_UnityLogo.image.height), EditorUpdateWindow.s_UnityLogo, GUIStyle.none);
     GUILayout.Space(5f);
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayout.Space(120f);
     GUILayout.BeginVertical(new GUILayoutOption[0]);
     if (EditorUpdateWindow.s_HasConnectionError)
     {
         GUILayout.Label(EditorUpdateWindow.s_ErrorString, "WordWrappedLabel", new GUILayoutOption[]
         {
             GUILayout.Width(405f)
         });
     }
     else if (EditorUpdateWindow.s_HasUpdate)
     {
         GUILayout.Label(string.Format(EditorUpdateWindow.s_TextHasUpdate.text, InternalEditorUtility.GetFullUnityVersion(), EditorUpdateWindow.s_LatestVersionString), "WordWrappedLabel", new GUILayoutOption[]
         {
             GUILayout.Width(300f)
         });
         GUILayout.Space(20f);
         this.m_ScrollPos = EditorGUILayout.BeginScrollView(this.m_ScrollPos, new GUILayoutOption[]
         {
             GUILayout.Width(405f),
             GUILayout.Height(200f)
         });
         GUILayout.Label(EditorUpdateWindow.s_LatestVersionMessage, "WordWrappedLabel", new GUILayoutOption[0]);
         EditorGUILayout.EndScrollView();
         GUILayout.Space(20f);
         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
         if (GUILayout.Button("Download new version", new GUILayoutOption[]
         {
             GUILayout.Width(200f)
         }))
         {
             Help.BrowseURL(EditorUpdateWindow.s_UpdateURL);
         }
         if (GUILayout.Button("Skip new version", new GUILayoutOption[]
         {
             GUILayout.Width(200f)
         }))
         {
             EditorPrefs.SetString("EditorUpdateSkipVersionString", EditorUpdateWindow.s_LatestVersionString);
             base.Close();
         }
         GUILayout.EndHorizontal();
     }
     else
     {
         GUILayout.Label(string.Format(EditorUpdateWindow.s_TextUpToDate.text, Application.unityVersion), "WordWrappedLabel", new GUILayoutOption[]
         {
             GUILayout.Width(405f)
         });
     }
     GUILayout.EndVertical();
     GUILayout.EndHorizontal();
     GUILayout.Space(8f);
     GUILayout.FlexibleSpace();
     GUILayout.BeginHorizontal(new GUILayoutOption[]
     {
         GUILayout.Height(20f)
     });
     GUILayout.FlexibleSpace();
     GUI.changed = false;
     EditorUpdateWindow.s_ShowAtStartup = GUILayout.Toggle(EditorUpdateWindow.s_ShowAtStartup, EditorUpdateWindow.s_CheckForNewUpdatesText, new GUILayoutOption[0]);
     if (GUI.changed)
     {
         EditorPrefs.SetBool("EditorUpdateShowAtStartup", EditorUpdateWindow.s_ShowAtStartup);
     }
     GUILayout.Space(10f);
     GUILayout.EndHorizontal();
     GUILayout.EndVertical();
 }
示例#7
0
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
        {
            Material material = materialEditor.target as Material;

            FindProperties(properties);

            //	Always needed vars
            bool surfaceModeChanged = false;
            var  workflow           = (WorkflowMode)workflowmodeProp.floatValue;
            var  surface            = (SurfaceType)surfaceTypeProp.floatValue;
            bool alphaclipChanged   = false;
            var  alphaclip          = (alphaClipProp.floatValue == 1)? true : false;


//	-----------------------
//	Help
            var txt       = new GUIContent("Help");
            var position  = GUILayoutUtility.GetRect(txt, GUIStyle.none);
            var headerPos = new Rect(position.x + 1, position.y, position.width - 20, 20);
            var btnPos    = new Rect(position.x + headerPos.width, position.y, 20, 20);

            GUI.Label(headerPos, new GUIContent("Help"), EditorStyles.boldLabel);
            if (GUI.Button(btnPos, helpbuttonGUIContent, EditorStyles.boldLabel))
            {
                Help.BrowseURL(url);
            }
            GUILayout.Space(10);

//	-----------------------
//	Surface Options

            openSurfaceOptions = (surfaceOptionsProps.floatValue == 1.0f) ? true : false;
            EditorGUI.BeginChangeCheck();
            openSurfaceOptions = EditorGUILayout.BeginFoldoutHeaderGroup(openSurfaceOptions, "Surface Options");
            if (EditorGUI.EndChangeCheck())
            {
                surfaceOptionsProps.floatValue = openSurfaceOptions? 1.0f : 0.0f;
            }

            if (openSurfaceOptions)
            {
                //	Workflow
                EditorGUI.BeginChangeCheck();
                //var workflow = (WorkflowMode)workflowmodeProp.floatValue;
                workflow = (WorkflowMode)EditorGUILayout.EnumPopup("Workflow Mode", workflow);
                if (EditorGUI.EndChangeCheck())
                {
                    materialEditor.RegisterPropertyChangeUndo("Workflow Mode");
                    workflowmodeProp.floatValue = (float)workflow;
                    if ((float)workflow == 0.0f)
                    {
                        material.EnableKeyword("_SPECULAR_SETUP");
                    }
                    else
                    {
                        material.DisableKeyword("_SPECULAR_SETUP");
                    }
                }

                //	Surface
                EditorGUI.BeginChangeCheck();
                //var surface = (SurfaceType)surfaceTypeProp.floatValue;
                surface = (SurfaceType)EditorGUILayout.EnumPopup("Surface Type", surface);
                if (EditorGUI.EndChangeCheck())
                {
                    materialEditor.RegisterPropertyChangeUndo("Surface Type");
                    surfaceModeChanged         = true;
                    surfaceTypeProp.floatValue = (float)surface;
                    if (surface == SurfaceType.Opaque)
                    {
                        material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
                        material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
                        material.SetInt("_ZWrite", 1);
                        material.SetOverrideTag("RenderType", "Opaque");
                        material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Geometry + 50;
                        material.SetShaderPassEnabled("ShadowCaster", true);
                    }
                    else
                    {
                        material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent + 50;                 // Make it match Standard Lit shader
                        material.SetOverrideTag("RenderType", "Transparent");
                        material.SetShaderPassEnabled("ShadowCaster", false);
                    }
                }

                //	Culling
                EditorGUI.BeginChangeCheck();
                var culling = (RenderFace)cullingProp.floatValue;
                culling = (RenderFace)EditorGUILayout.EnumPopup("Render Face", culling);
                if (EditorGUI.EndChangeCheck())
                {
                    materialEditor.RegisterPropertyChangeUndo("Cull");
                    cullingProp.floatValue = (float)culling;
                    material.doubleSidedGI = (RenderFace)cullingProp.floatValue != RenderFace.Front;
                }

                //	Alpha Clipping
//	Allow alpha clipping for transparents as well
//	            if (surface == SurfaceType.Opaque) {
                EditorGUI.BeginChangeCheck();
                alphaclip = EditorGUILayout.Toggle(new GUIContent("Alpha Clipping"), alphaClipProp.floatValue == 1);
                //	Make sure we set alpha clip if surface type has changed only as well
                if (EditorGUI.EndChangeCheck() || surfaceModeChanged)
                {
                    alphaclipChanged = true;
                    if (alphaclip)
                    {
                        alphaClipProp.floatValue = 1;
                        material.EnableKeyword("_ALPHATEST_ON");
                        material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest + 50;
                        material.SetOverrideTag("RenderType", "TransparentCutout");

                        //	We may have to re eanble camera fading
                        if (cameraFadingEnabledProp.floatValue == 1)
                        {
                            material.EnableKeyword("_FADING_ON");
                            if (cameraFadeShadowsProp.floatValue == 1)
                            {
                                material.EnableKeyword("_FADING_SHADOWS_ON");
                            }
                            else
                            {
                                material.DisableKeyword("_FADING_SHADOWS_ON");
                            }
                        }
                        else
                        {
                            material.DisableKeyword("_FADING_ON");
                            material.DisableKeyword("_FADING_SHADOWS_ON");
                        }
                    }
                    else
                    {
                        alphaClipProp.floatValue = 0;
                        material.DisableKeyword("_ALPHATEST_ON");
                        material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Geometry + 50;
                        material.SetOverrideTag("RenderType", "Opaque");

                        material.DisableKeyword("_FADING_ON");
                        material.DisableKeyword("_FADING_SHADOWS_ON");
                    }
                }
                if (alphaclip)
                {
                    materialEditor.ShaderProperty(alphaCutoffProp, "Threshold", 1);
                }
//	            }

                //	Camera Fading
                if (alphaclip)
                {
                    EditorGUI.BeginChangeCheck();
                    materialEditor.ShaderProperty(cameraFadingEnabledProp, "Camera Fading", 1);
                    materialEditor.ShaderProperty(cameraFadeDistProp, "Fade Distance", 2);
                    materialEditor.ShaderProperty(cameraFadeShadowsProp, "Fade Shadows", 2);
                    materialEditor.ShaderProperty(cameraShadowFadeDistProp, "Shadow Fade Dist", 2);

                    if (EditorGUI.EndChangeCheck())
                    {
                        if (cameraFadingEnabledProp.floatValue == 1)
                        {
                            material.EnableKeyword("_FADING_ON");
                            if (cameraFadeShadowsProp.floatValue == 1)
                            {
                                material.EnableKeyword("_FADING_SHADOWS_ON");
                            }
                            else
                            {
                                material.DisableKeyword("_FADING_SHADOWS_ON");
                            }
                        }
                        else
                        {
                            material.DisableKeyword("_FADING_ON");
                            material.DisableKeyword("_FADING_SHADOWS_ON");
                        }
                    }
                }
                else
                {
                    material.DisableKeyword("_FADING_ON");
                    material.DisableKeyword("_FADING_SHADOWS_ON");
                }

                //	Shadows
                EditorGUI.BeginChangeCheck();
                var receiveShadows = EditorGUILayout.Toggle(new GUIContent("Receive Shadows"), receiveShadowsProp.floatValue == 1.0f);
                if (EditorGUI.EndChangeCheck())
                {
                    receiveShadowsProp.floatValue = receiveShadows ? 1.0f : 0.0f;
                    if (receiveShadows)
                    {
                        material.DisableKeyword("_RECEIVE_SHADOWS_OFF");
                    }
                    else
                    {
                        material.EnableKeyword("_RECEIVE_SHADOWS_OFF");
                    }
                }


                //	Transparency
                if (surface == SurfaceType.Transparent)
                {
                    EditorGUI.BeginChangeCheck();
                    //DoPopup(Styles.blendingMode, blendModeProp, Enum.GetNames(typeof(BlendMode)));
                    var blendMode = (BlendMode)blendModeProp.floatValue;
                    blendMode = (BlendMode)EditorGUILayout.EnumPopup("Blend Mode", blendMode);
                    //	Make sure we set blend mode if surface type has changed only as well
                    if (EditorGUI.EndChangeCheck() || surfaceModeChanged)
                    {
                        blendModeProp.floatValue = (float)blendMode;

                        material.DisableKeyword("_ALPHATEST_ON");

                        switch (blendMode)
                        {
                        case BlendMode.Alpha:
                            material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
                            material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
                            material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
                            break;

                        case BlendMode.Premultiply:
                            material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
                            material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
                            material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
                            break;

                        case BlendMode.Additive:
                            material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
                            material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.One);
                            material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
                            break;

                        case BlendMode.Multiply:
                            material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.DstColor);
                            material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
                            material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
                            material.EnableKeyword("_ALPHAMODULATE_ON");
                            break;
                        }
                    }
                }

                //	ZTesting
                EditorGUI.BeginChangeCheck();
                var ztest = (UnityEngine.Rendering.CompareFunction)ztestProp.floatValue;
                ztest = (UnityEngine.Rendering.CompareFunction)EditorGUILayout.EnumPopup("ZTest", ztest);
                if (EditorGUI.EndChangeCheck())
                {
                    materialEditor.RegisterPropertyChangeUndo("ZTest");
                    ztestProp.floatValue = (float)ztest;
                }

                //	Spacing
                EditorGUILayout.Space();
            }
            EditorGUILayout.EndFoldoutHeaderGroup();

//	-----------------------
//	Surface Inputs

            openSurfaceInputs = (surfaceInputsProps.floatValue == 1.0f) ? true : false;
            EditorGUI.BeginChangeCheck();
            openSurfaceInputs = EditorGUILayout.BeginFoldoutHeaderGroup(openSurfaceInputs, "Surface Inputs");
            if (EditorGUI.EndChangeCheck())
            {
                surfaceInputsProps.floatValue = openSurfaceInputs? 1.0f : 0.0f;
            }
            if (openSurfaceInputs)
            {
                EditorGUILayout.Space();

                //	Basemap / Color
                materialEditor.TexturePropertySingleLine(new GUIContent("Base Map"), baseMapProp, baseColorProp);

                //	Metallic
                string[] smoothnessChannelNames;
                bool     hasGlossMap = false;
                if ((WorkflowMode)workflowmodeProp.floatValue == WorkflowMode.Metallic)
                {
                    hasGlossMap            = metallicGlossMapProp.textureValue != null;
                    smoothnessChannelNames = Styles.metallicSmoothnessChannelNames;
                    EditorGUI.BeginChangeCheck();
                    materialEditor.TexturePropertySingleLine(new GUIContent("Metallic Map"), metallicGlossMapProp, hasGlossMap ? null : metallicProp);
                    if (EditorGUI.EndChangeCheck())
                    {
                        if (metallicGlossMapProp.textureValue != null)
                        {
                            material.EnableKeyword("_METALLICSPECGLOSSMAP");
                        }
                        else
                        {
                            material.DisableKeyword("_METALLICSPECGLOSSMAP");
                        }
                    }
                }

                //	Specular
                else
                {
                    hasGlossMap            = specGlossMapProp.textureValue != null;
                    smoothnessChannelNames = Styles.specularSmoothnessChannelNames;
                    EditorGUI.BeginChangeCheck();
                    materialEditor.TexturePropertySingleLine(new GUIContent("Specular Map"), specGlossMapProp, hasGlossMap ? null : specColorProp);
                    if (EditorGUI.EndChangeCheck())
                    {
                        if (specGlossMapProp.textureValue != null)
                        {
                            material.EnableKeyword("_METALLICSPECGLOSSMAP");
                        }
                        else
                        {
                            material.DisableKeyword("_METALLICSPECGLOSSMAP");
                        }
                    }
                }

                //	Smoothness
                EditorGUI.indentLevel++;
                EditorGUI.indentLevel++;
                EditorGUI.BeginChangeCheck();
                EditorGUI.showMixedValue = smoothnessProp.hasMixedValue;
                var smoothness = EditorGUILayout.Slider("Smoothness", smoothnessProp.floatValue, 0f, 1f);
                if (EditorGUI.EndChangeCheck())
                {
                    smoothnessProp.floatValue = smoothness;
                }
                EditorGUI.showMixedValue = false;
                EditorGUI.indentLevel--;
                //	Chose Smoothness Cannel in case we have any GlossMap
                //if (hasGlossMap) {
                EditorGUI.indentLevel++;

                EditorGUI.BeginDisabledGroup(surface != SurfaceType.Opaque);
                EditorGUI.BeginChangeCheck();
                EditorGUI.showMixedValue = smoothnessMapChannelProp.hasMixedValue;
                var smoothnessSource = (int)smoothnessMapChannelProp.floatValue;
                //	This is correct, but it does not allow fading
                if (surface == SurfaceType.Opaque && !alphaclip)
                {
                    smoothnessSource = EditorGUILayout.Popup(new GUIContent("Source"), smoothnessSource, smoothnessChannelNames);
                }
                else
                {
                    GUI.enabled = false;
                    EditorGUILayout.Popup(new GUIContent("Source"), 0, smoothnessChannelNames);
                    material.DisableKeyword("_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A");
                    GUI.enabled = true;
                }
                //	Make sure we set the proper keyword even if only alphaclip has changed as well
                if (EditorGUI.EndChangeCheck() || alphaclipChanged)
                {
                    smoothnessMapChannelProp.floatValue = smoothnessSource;
                    if (smoothnessSource == 1)
                    {
                        material.EnableKeyword("_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A");
                    }
                    else
                    {
                        material.DisableKeyword("_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A");
                    }
                }
                EditorGUI.showMixedValue = false;
                EditorGUI.EndDisabledGroup();
                EditorGUI.indentLevel--;
                //}
                //	We may still sample from Albedo alpha

/*		            else {
 *                              //	We can not sample smoothness from albedo alpha of the shader is transparent
 *                                      if (surface == SurfaceType.Opaque && !alphaclip) {
 *                                              EditorGUI.indentLevel++;
 *                                                      EditorGUI.BeginChangeCheck();
 *                                                      var smoothnessFromAlbedoAlpha = EditorGUILayout.Toggle(new GUIContent("Source Albedo Alpha"), smoothnessMapChannelProp.floatValue == 1);
 *                                                      if (EditorGUI.EndChangeCheck()) {
 *                                                              if (smoothnessFromAlbedoAlpha) {
 *                                                                      smoothnessMapChannelProp.floatValue = 1;
 *                                                                      material.EnableKeyword("_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A");
 *                                                              }
 *                                                              else {
 *                                                                      smoothnessMapChannelProp.floatValue = 0;
 *                                                                      material.DisableKeyword("_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A");
 *                                                              }
 *                                                      }
 *                                              EditorGUI.indentLevel--;
 *                                      }
 *                                      else {
 *                                              smoothnessMapChannelProp.floatValue = 0;
 *                                              material.DisableKeyword("_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A");
 *                                      }
 *                              }
 */
                EditorGUI.indentLevel--;

                //	Normal
                //	NOTE: _NORMALMAP is needed by Bent normal as well: see sh lighting.
                EditorGUI.BeginChangeCheck();
                materialEditor.TexturePropertySingleLine(new GUIContent("Normal Map"), bumpMapProp, bumpMapScaleProp);
                if (EditorGUI.EndChangeCheck() || bumpMapProp.textureValue == null)
                {
                    if (bumpMapProp.textureValue != null && bumpMapScaleProp.floatValue != 0.0f)
                    {
                        material.EnableKeyword("_NORMALMAP");
                        material.EnableKeyword("_SAMPLENORMAL");
                        enableNormalProp.floatValue = 1.0f;
                    }
                    else
                    {
                        if (BentNormalMapProp.textureValue == null)
                        {
                            material.DisableKeyword("_NORMALMAP");
                        }
                        material.DisableKeyword("_SAMPLENORMAL");
                        enableNormalProp.floatValue = 0.0f;
                    }
                }

                //	Occlusion
                EditorGUI.BeginChangeCheck();
                materialEditor.TexturePropertySingleLine(new GUIContent("Occlusion Map"), occlusionMapProp, occlusionMapProp.textureValue != null ? occlusionStrengthProp : null);
                if (EditorGUI.EndChangeCheck())
                {
                    if (occlusionMapProp.textureValue != null && occlusionStrengthProp.floatValue > 0)
                    {
                        material.EnableKeyword("_OCCLUSIONMAP");
                        enableOcclusionProp.floatValue = 1;
                    }
                    else
                    {
                        material.DisableKeyword("_OCCLUSIONMAP");
                        enableOcclusionProp.floatValue = 0;
                    }
                }

                //	Emission
                EditorGUI.BeginChangeCheck();
                var emission = EditorGUILayout.Toggle(new GUIContent("Emission"), (emissionProp.floatValue == 1)? true : false);
                if (EditorGUI.EndChangeCheck())
                {
                    if (emission)
                    {
                        material.EnableKeyword("_EMISSION");
                        emissionProp.floatValue = 1;
                    }
                    else
                    {
                        material.DisableKeyword("_EMISSION");
                        emissionProp.floatValue = 0;
                    }
                }
                if (emission)
                {
                    EditorGUI.BeginChangeCheck();
                    materialEditor.TexturePropertyWithHDRColor(new GUIContent("Emission Map"), emissionMapProp, emissionColorProp, false);
                    if (EditorGUI.EndChangeCheck())
                    {
                        var brightness = emissionColorProp.colorValue.maxColorComponent;
                        material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.BakedEmissive;
                        if (brightness <= 0f)
                        {
                            material.globalIlluminationFlags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack;
                        }
                    }
                }

                //	Tiling
                EditorGUILayout.Space();
                materialEditor.TextureScaleOffsetProperty(baseMapProp);

                //	Spacing
                EditorGUILayout.Space();
            }
            EditorGUILayout.EndFoldoutHeaderGroup();

//	-----------------------
//	Advanced Surface Inputs

            GUIContent labeltooltip;

            openAdvancedSurfaceInputs = (advancedSurfaceInputsProps.floatValue == 1.0f) ? true : false;
            EditorGUI.BeginChangeCheck();
            openAdvancedSurfaceInputs = EditorGUILayout.BeginFoldoutHeaderGroup(openAdvancedSurfaceInputs, "Advanced Surface Inputs");
            if (EditorGUI.EndChangeCheck())
            {
                advancedSurfaceInputsProps.floatValue = openAdvancedSurfaceInputs? 1.0f : 0.0f;
            }
            if (openAdvancedSurfaceInputs)
            {
                EditorGUILayout.Space();

                //	Parallax
                EditorGUI.BeginChangeCheck();
                labeltooltip = new GUIContent("Height Map (G)", "RGB texture which stores height in the green color channel used by parallax extrusion.");
                materialEditor.TexturePropertySingleLine(new GUIContent("Height Map (G)"), heightMapProp, heightMapProp.textureValue != null ? parallaxProp : null);
                if (EditorGUI.EndChangeCheck())
                {
                    if ((heightMapProp.textureValue != null) && (parallaxProp.floatValue > 0))
                    {
                        material.EnableKeyword("_PARALLAX");
                        enableParallaxProp.floatValue = 1;
                    }
                    else
                    {
                        material.DisableKeyword("_PARALLAX");
                        enableParallaxProp.floatValue = 0;
                    }
                }
                if (alphaclip && (heightMapProp.textureValue != null) && (parallaxProp.floatValue > 0))
                {
                    EditorGUI.BeginChangeCheck();
                    labeltooltip = new GUIContent("Parallax Shadows", "If checked the shader will apply parallax mapping even in the shadow caster pass. This is somehow correct for directional shadows where we can derive the view direction from the (shadow) camera’s forward vector but not in case we render spot lights. Furthermore even parallax directional shadow casters are quite unstable if you rotate the camera. So check if you really need this...");
                    var pShadows = EditorGUILayout.Toggle(labeltooltip, enableParallaxShadowsProp.floatValue == 1);
                    if (EditorGUI.EndChangeCheck() || surfaceModeChanged)
                    {
                        if (pShadows)
                        {
                            enableParallaxShadowsProp.floatValue = 1;
                            material.EnableKeyword("_PARALLAXSHADOWS");
                        }
                        else
                        {
                            enableParallaxShadowsProp.floatValue = 0;
                            material.DisableKeyword("_PARALLAXSHADOWS");
                        }
                    }
                    EditorGUILayout.Space();
                }
                else
                {
                    enableParallaxShadowsProp.floatValue = 0;
                    material.DisableKeyword("_PARALLAXSHADOWS");
                }



                //	Bent Normals
                EditorGUI.BeginChangeCheck();
                labeltooltip = new GUIContent("Bent Normal Map", "Cosine weighted Bent Normal Map in tangent space. If assigned the shader will tweak ambient diffuse lighting and ambient specular reflections.");
                materialEditor.TexturePropertySingleLine(labeltooltip, BentNormalMapProp);
                if (EditorGUI.EndChangeCheck())
                {
                    if (BentNormalMapProp.textureValue != null)
                    {
                        EnableBentNormalProp.floatValue = 1;
                        material.EnableKeyword("_BENTNORMAL");
                        material.EnableKeyword("_NORMALMAP");
                    }
                    else
                    {
                        EnableBentNormalProp.floatValue = 0;
                        material.DisableKeyword("_BENTNORMAL");
                        if (bumpMapProp.textureValue == null)
                        {
                            material.DisableKeyword("_NORMALMAP");
                        }
                    }
                }

                //	Horizon Occlusion
                labeltooltip = new GUIContent("Horizon Occlusion", "Terminates light leaking caused by normal mapped ambient specular reflections where the reflection vector might end up pointing behind the surface being rendered.");
                materialEditor.ShaderProperty(HorizonOcclusionProp, labeltooltip, 0);


                //	Specular AA
                EditorGUI.BeginChangeCheck();

                labeltooltip = new GUIContent("Geometric Specular AA", "When enabled the shader reduces specular aliasing on high density meshes by reducing smoothness at grazing angles.");
                var specAA = EditorGUILayout.Toggle(labeltooltip, GeometricSpecularAAProp.floatValue == 1);
                if (EditorGUI.EndChangeCheck())
                {
                    if (specAA)
                    {
                        GeometricSpecularAAProp.floatValue = 1;
                        material.EnableKeyword("_ENABLE_GEOMETRIC_SPECULAR_AA");
                    }
                    else
                    {
                        GeometricSpecularAAProp.floatValue = 0;
                        material.DisableKeyword("_ENABLE_GEOMETRIC_SPECULAR_AA");
                    }
                }
                if (specAA)
                {
                    labeltooltip = new GUIContent("Screen Space Variance", "Controls the amount of Specular AA. Higher values give a more blurry result.");
                    materialEditor.ShaderProperty(ScreenSpaceVarianceProp, labeltooltip, 1);
                    labeltooltip = new GUIContent("Threshold", "Controls the amount of Specular AA. Higher values allow higher reduction.");
                    materialEditor.ShaderProperty(SAAThresholdProp, labeltooltip, 1);
                }

                //	GI TO AO
                EditorGUI.BeginChangeCheck();
                labeltooltip = new GUIContent("GI to Specular Occlusion", "In case you use lightmaps you may activate this feature to derive some kind of specular occlusion just from the lightmap and its baked ambient occlusion.");
                var GIAO = EditorGUILayout.Toggle(labeltooltip, AOfromGIProp.floatValue == 1);
                if (EditorGUI.EndChangeCheck())
                {
                    if (GIAO)
                    {
                        AOfromGIProp.floatValue = 1;
                        material.EnableKeyword("_ENABLE_AO_FROM_GI");
                    }
                    else
                    {
                        AOfromGIProp.floatValue = 0;
                        material.DisableKeyword("_ENABLE_AO_FROM_GI");
                    }
                }
                if (GIAO)
                {
                    labeltooltip = new GUIContent("GI to AO Factor", "Controls the amount of specular occlusion. It acts as a factor to brighten the value sampled from the lightmap.");
                    materialEditor.ShaderProperty(GItoAOProp, labeltooltip, 1);
                    labeltooltip = new GUIContent("Bias", "Adds a constant value to brighten the value sampled from the lightmap.");
                    materialEditor.ShaderProperty(GItoAOBiasProp, labeltooltip, 1);
                }


                //	Spacing
                EditorGUILayout.Space();
            }
            EditorGUILayout.EndFoldoutHeaderGroup();

//	-----------------------
//	Rim Lighting
            openRimLighingInputs = (RimLighingInputsProps.floatValue == 1.0f) ? true : false;
            EditorGUI.BeginChangeCheck();
            openRimLighingInputs = EditorGUILayout.BeginFoldoutHeaderGroup(openRimLighingInputs, "Rim Lighting");
            if (EditorGUI.EndChangeCheck())
            {
                RimLighingInputsProps.floatValue = openRimLighingInputs? 1.0f : 0.0f;
            }
            if (openRimLighingInputs)
            {
                //	Rim
                EditorGUI.BeginChangeCheck();
                materialEditor.ShaderProperty(RimProp, "Enable Rim Lighting", 0);
                materialEditor.ShaderProperty(RimColorProp, "Rim Color", 0);
                materialEditor.ShaderProperty(RimPowerProp, "Rim Power", 0);
                materialEditor.ShaderProperty(RimFrequencyProp, "Rim Frequency", 0);
                materialEditor.ShaderProperty(RimMinPowerProp, "Rim Min Power", 1);
                materialEditor.ShaderProperty(RimPerPositionFrequencyProp, "Rim Per Position Frequency", 1);
                if (EditorGUI.EndChangeCheck())
                {
                    if (RimProp.floatValue == 1)
                    {
                        material.EnableKeyword("_RIMLIGHTING");
                    }
                    else
                    {
                        material.DisableKeyword("_RIMLIGHTING");
                    }
                }

                EditorGUILayout.Space();
            }


            EditorGUILayout.EndFoldoutHeaderGroup();


//	-----------------------
//	Stencil Inputs
            openStencilOptions = (stencilOptionsProps.floatValue == 1.0f) ? true : false;
            EditorGUI.BeginChangeCheck();
            openStencilOptions = EditorGUILayout.BeginFoldoutHeaderGroup(openStencilOptions, "Stencil Options");
            if (EditorGUI.EndChangeCheck())
            {
                stencilOptionsProps.floatValue = openStencilOptions? 1.0f : 0.0f;
            }
            if (openStencilOptions)
            {
                //	Stencil
                materialEditor.ShaderProperty(stencilProp, "Stencil Reference", 0);
                materialEditor.ShaderProperty(readMaskProp, "Read Mask", 0);
                materialEditor.ShaderProperty(writeMaskProp, "Write Mask", 0);
                materialEditor.ShaderProperty(stencilCompProp, "Stencil Comparison", 0);
                materialEditor.ShaderProperty(stencilOpProp, "Stencil Operation", 0);
                materialEditor.ShaderProperty(stencilFailProp, "Stencil Fail Op", 0);
                materialEditor.ShaderProperty(stenciZfailProp, "Stencil ZFail Op", 0);

                EditorGUILayout.Space();
            }


            EditorGUILayout.EndFoldoutHeaderGroup();

//	-----------------------
//	Advanced Settings
            openAdvancedOptions = (advancedOptionsProps.floatValue == 1.0f) ? true : false;
            EditorGUI.BeginChangeCheck();
            openAdvancedOptions = EditorGUILayout.BeginFoldoutHeaderGroup(openAdvancedOptions, "Advanced");
            if (EditorGUI.EndChangeCheck())
            {
                advancedOptionsProps.floatValue = openAdvancedOptions? 1.0f : 0.0f;
            }
            if (openAdvancedOptions)
            {
                EditorGUI.BeginChangeCheck();
                materialEditor.ShaderProperty(SpecularHighlightsProps, "Specular Highlights", 0);
                materialEditor.ShaderProperty(EnvironmentReflectionsProps, "Environment Reflections", 0);
                materialEditor.EnableInstancingField();
                materialEditor.RenderQueueField();
                if (EditorGUI.EndChangeCheck())
                {
                    if (SpecularHighlightsProps.floatValue == 1)
                    {
                        material.DisableKeyword("_SPECULARHIGHLIGHTS_OFF");
                    }
                    else
                    {
                        material.EnableKeyword("_SPECULARHIGHLIGHTS_OFF");
                    }
                    if (EnvironmentReflectionsProps.floatValue == 1)
                    {
                        material.DisableKeyword("_ENVIRONMENTREFLECTIONS_OFF");
                    }
                    else
                    {
                        material.EnableKeyword("_ENVIRONMENTREFLECTIONS_OFF");
                    }
                }
                EditorGUILayout.Space();
            }

            EditorGUILayout.EndFoldoutHeaderGroup();

            //	Fix all the missing stuff

            //  Needed to make the Selection Outline work
            //	Lightmapper needs it for alpha testing?!
            if (material.HasProperty("_MainTex") && material.HasProperty("_BaseMap"))
            {
                if (material.GetTexture("_BaseMap") != null)
                {
                    material.SetTexture("_MainTex", material.GetTexture("_BaseMap"));
                }
            }
        }
        public void OnGUI()
        {
            LoadResources();


            GUILayout.BeginVertical();
            GUILayout.Space(10);
            GUI.Box(new Rect(13, 8, s_UnityLogo.image.width, s_UnityLogo.image.height), s_UnityLogo, GUIStyle.none);
            GUILayout.Space(5);
            GUILayout.BeginHorizontal();
            GUILayout.Space(120);
            GUILayout.BeginVertical();

            if (s_HasConnectionError)
            {
                GUILayout.Label(s_ErrorString, "WordWrappedLabel", GUILayout.Width(405));
            }
            else if (s_HasUpdate)
            {
                GUILayout.Label(string.Format(s_TextHasUpdate.text, InternalEditorUtility.GetFullUnityVersion(), s_LatestVersionString), "WordWrappedLabel", GUILayout.Width(300));

                GUILayout.Space(20);
                m_ScrollPos = EditorGUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(405), GUILayout.Height(200));
                GUILayout.Label(s_LatestVersionMessage, "WordWrappedLabel");
                EditorGUILayout.EndScrollView();

                GUILayout.Space(20);
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Download new version", GUILayout.Width(200)))
                {
                    Help.BrowseURL(s_UpdateURL);
                }

                if (GUILayout.Button("Skip new version", GUILayout.Width(200)))
                {
                    EditorPrefs.SetString("EditorUpdateSkipVersionString", s_LatestVersionString);
                    Close();
                }
                GUILayout.EndHorizontal();
            }
            else
            {
                GUILayout.Label(string.Format(s_TextUpToDate.text, Application.unityVersion), "WordWrappedLabel", GUILayout.Width(405));
            }


            GUILayout.EndVertical();
            GUILayout.EndHorizontal();

            GUILayout.Space(8);


            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(GUILayout.Height(20));
            GUILayout.FlexibleSpace();
            GUI.changed     = false;
            s_ShowAtStartup = GUILayout.Toggle(s_ShowAtStartup, s_CheckForNewUpdatesText);
            if (GUI.changed)
            {
                EditorPrefs.SetBool("EditorUpdateShowAtStartup", s_ShowAtStartup);
            }

            GUILayout.Space(10);
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }