//------------------------------------
 // Methods
 //------------------------------------
 public void FindProperties(MaterialProperty[] props)
 {
     this.blendMode    = ShaderGUI.FindProperty("_Mode", props);
     this.albedoMap    = ShaderGUI.FindProperty("_MainTex", props);
     this.grungeMap    = ShaderGUI.FindProperty("_GrungeMask", props);
     this.grungeFactor = ShaderGUI.FindProperty("_GrungeFactor", props);
     this.albedoColor  = ShaderGUI.FindProperty("_Color", props);
     //this.alphaCutoff = ShaderGUI.FindProperty("_Cutoff", props);
     this.specularMap               = ShaderGUI.FindProperty("_SpecGlossMap", props, false);
     this.specularColor             = ShaderGUI.FindProperty("_SpecColor", props, false);
     this.metallicMap               = ShaderGUI.FindProperty("_MetallicGlossMap", props, false);
     this.metallic                  = ShaderGUI.FindProperty("_Metallic", props, false);
     this.m_WorkflowMode            = this.specularMap == null || this.specularColor == null ? (this.metallicMap == null || this.metallic == null ? EDStandardShaderGUI.WorkflowMode.Dielectric : EDStandardShaderGUI.WorkflowMode.Metallic) : EDStandardShaderGUI.WorkflowMode.Specular;
     this.smoothness                = ShaderGUI.FindProperty("_Glossiness", props);
     this.bumpScale                 = ShaderGUI.FindProperty("_BumpScale", props);
     this.bumpMap                   = ShaderGUI.FindProperty("_BumpMap", props);
     this.heigtMapScale             = ShaderGUI.FindProperty("_Parallax", props);
     this.heightMap                 = ShaderGUI.FindProperty("_ParallaxMap", props);
     this.occlusionStrength         = ShaderGUI.FindProperty("_OcclusionStrength", props);
     this.occlusionMap              = ShaderGUI.FindProperty("_OcclusionMap", props);
     this.emissionColorForRendering = ShaderGUI.FindProperty("_EmissionColor", props);
     this.emissionMap               = ShaderGUI.FindProperty("_EmissionMap", props);
     this.detailMask                = ShaderGUI.FindProperty("_DetailMask", props);
     this.detailAlbedoMap           = ShaderGUI.FindProperty("_DetailAlbedoMap", props);
     this.detailNormalMapScale      = ShaderGUI.FindProperty("_DetailNormalMapScale", props);
     this.detailNormalMap           = ShaderGUI.FindProperty("_DetailNormalMap", props);
     this.uvSetSecondary            = ShaderGUI.FindProperty("_UVSec", props);
 }
        private static void SetMaterialKeywords(Material material, EDStandardShaderGUI.WorkflowMode workflowMode)
        {
            EDStandardShaderGUI.SetKeyword(material, "_NORMALMAP", (bool)((UnityEngine.Object)material.GetTexture("_BumpMap")) || (bool)((UnityEngine.Object)material.GetTexture("_DetailNormalMap")));
            if (workflowMode == EDStandardShaderGUI.WorkflowMode.Specular)
            {
                EDStandardShaderGUI.SetKeyword(material, "_SPECGLOSSMAP", (bool)((UnityEngine.Object)material.GetTexture("_SpecGlossMap")));
            }
            else if (workflowMode == EDStandardShaderGUI.WorkflowMode.Metallic)
            {
                EDStandardShaderGUI.SetKeyword(material, "_METALLICGLOSSMAP", (bool)((UnityEngine.Object)material.GetTexture("_MetallicGlossMap")));
            }
            EDStandardShaderGUI.SetKeyword(material, "_PARALLAXMAP", (bool)((UnityEngine.Object)material.GetTexture("_ParallaxMap")));
            EDStandardShaderGUI.SetKeyword(material, "_DETAIL_MULX2", (bool)((UnityEngine.Object)material.GetTexture("_DetailAlbedoMap")) || (bool)((UnityEngine.Object)material.GetTexture("_DetailNormalMap")));
            bool state = EDStandardShaderGUI.ShouldEmissionBeEnabled(material.GetColor("_EmissionColor"));

            EDStandardShaderGUI.SetKeyword(material, "_EMISSION", state);
            MaterialGlobalIlluminationFlags illuminationFlags1 = material.globalIlluminationFlags;

            if ((illuminationFlags1 & (MaterialGlobalIlluminationFlags.RealtimeEmissive | MaterialGlobalIlluminationFlags.BakedEmissive)) == MaterialGlobalIlluminationFlags.None)
            {
                return;
            }
            MaterialGlobalIlluminationFlags illuminationFlags2 = illuminationFlags1 & ~MaterialGlobalIlluminationFlags.EmissiveIsBlack;

            if (!state)
            {
                illuminationFlags2 |= MaterialGlobalIlluminationFlags.EmissiveIsBlack;
            }
            material.globalIlluminationFlags = illuminationFlags2;
        }
 internal void DetermineWorkflow(MaterialProperty[] props)
 {
     if (ShaderGUI.FindProperty("_SpecGlossMap", props, false) != null && ShaderGUI.FindProperty("_SpecColor", props, false) != null)
     {
         this.m_WorkflowMode = EDStandardShaderGUI.WorkflowMode.Specular;
     }
     else if (ShaderGUI.FindProperty("_MetallicGlossMap", props, false) != null && ShaderGUI.FindProperty("_Metallic", props, false) != null)
     {
         this.m_WorkflowMode = EDStandardShaderGUI.WorkflowMode.Metallic;
     }
     else
     {
         this.m_WorkflowMode = EDStandardShaderGUI.WorkflowMode.Dielectric;
     }
 }
 private static void MaterialChanged(Material material, EDStandardShaderGUI.WorkflowMode workflowMode)
 {
     EDStandardShaderGUI.SetupMaterialWithBlendMode(material, (EDStandardShaderGUI.BlendMode)material.GetFloat("_Mode"));
     EDStandardShaderGUI.SetMaterialKeywords(material, workflowMode);
 }