public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) { Material tm = materialEditor.target as Material; _specGlossMap = tm.IsKeywordEnabled("_SPECGLOSSMAP"); _metallic = tm.IsKeywordEnabled("_METALLIC"); _vertexColorMode = (VertexColorMode)ShaderGUIUtils.GetMultiCompileKeywordIndex(vertexColorKeywords, tm); _alphaTest = tm.IsKeywordEnabled("_ALPHATEST_ON"); _isTerrain = tm.shader.name.Contains("Terrain"); _isEnv = tm.shader.name.Contains("Environment"); is2Side = tm.shader.name.Contains("2-Side"); _isCharacter = tm.shader.name.Contains("Character"); _rimLight = tm.IsKeywordEnabled("RIM_LIGHT"); _deathDissolve = tm.IsKeywordEnabled("DEATH_DISSOLVE"); _breakable = tm.IsKeywordEnabled("IS_BREAKABLE"); _reverseBack = tm.IsKeywordEnabled("REVERSE_BACKSIDE"); _emissionOnLightmap = (tm.globalIlluminationFlags == MaterialGlobalIlluminationFlags.BakedEmissive); //clean up shader keywords List <string> keywords = new List <string>(); foreach (string s in tm.shaderKeywords) { if (ArrayUtility.Contains <string>(allKeywords, s)) { keywords.Add(s); } } tm.shaderKeywords = keywords.ToArray(); terrainCount = 0; if (is2Side) { _reverseBack = ShaderGUIUtils.ShaderKeywordToggle("反转反向法线", _reverseBack, "REVERSE_BACKSIDE", tm); } _vertexColorMode = (VertexColorMode)ShaderGUIUtils.MultiKeywordSwitch("顶点色模式", vertexColorOptions, vertexColorKeywords, (int)_vertexColorMode, tm); _alphaTest = ShaderGUIUtils.ShaderKeywordToggle("使用Alpha Test", _alphaTest, "_ALPHATEST_ON", tm); if (_alphaTest) { MaterialProperty _Cutoff = FindProperty("_Cutoff", properties); _Cutoff.floatValue = EditorGUILayout.Slider("Alpha Cutoff", _Cutoff.floatValue, 0, 1); //materialEditor.FloatProperty(FindProperty("_Cutoff", properties), "Cutoff"); } EditorGUILayout.Space(); MaterialProperty _Color = FindProperty("_Color", properties); materialEditor.ColorProperty(_Color, "整体颜色"); MaterialProperty _MainTex = FindProperty("_MainTex", properties); materialEditor.TexturePropertySingleLine(new GUIContent("主贴图", "RGB - albedo, A - 透明度"), _MainTex); MaterialProperty _BumpMap = FindProperty("_BumpMap", properties); materialEditor.TexturePropertySingleLine(new GUIContent("法线贴图"), _BumpMap); if (_isTerrain) { materialEditor.TextureScaleOffsetProperty(_MainTex); terrainCount = 1; } if (!_isTerrain) { if (!_isCharacter) { _metallic = ShaderGUIUtils.ShaderKeywordToggle("金属度模式", _metallic, "_METALLIC", tm); MaterialProperty _EmissionColor = FindProperty("_EmissionColor", properties); materialEditor.ColorProperty(_EmissionColor, "自发光颜色"); MaterialProperty _EmissionMap = FindProperty("_EmissionMap", properties); materialEditor.TexturePropertySingleLine(new GUIContent("自发光贴图"), _EmissionMap); } // if (!_specGlossMap) // { // if (_metallic) // { // MaterialProperty _Metallic = FindProperty("_Metallic", properties); // _Metallic.floatValue = EditorGUILayout.Slider("金属度", _Metallic.floatValue, 0, 1); // MaterialProperty _Roughness = FindProperty("_Roughness", properties); // _Roughness.floatValue = EditorGUILayout.Slider("粗糙度", _Roughness.floatValue, 0, 1); // } // else // { // materialEditor.ColorProperty(FindProperty("_SpecColor", properties), "高光色"); // MaterialProperty _Glossiness = FindProperty("_Glossiness", properties); // _Glossiness.floatValue = EditorGUILayout.Slider("光滑度", _Glossiness.floatValue, 0, 1); // } // } MaterialProperty _SpecGlossMap = FindProperty("_SpecGlossMap", properties); if (_metallic) { materialEditor.TexturePropertySingleLine(new GUIContent("高光贴图(MRAV)", "R-金属度,G-粗糙度,B-AO,A-顶点色遮罩"), _SpecGlossMap); } else { materialEditor.TexturePropertySingleLine(new GUIContent("R-光泽度 G-透贴 B-自发光遮罩", "R - 光泽度,G - 透贴, B - 自发光遮罩"), _SpecGlossMap); // materialEditor.TexturePropertySingleLine(new GUIContent("高光贴图(SSSG)", "RGB - 高光色, A - 光滑度"), _SpecGlossMap); // if (_isCharacter || _isEnv){ MaterialProperty _Glossiness = FindProperty("_Glossiness", properties); _Glossiness.floatValue = EditorGUILayout.Slider("光滑度", _Glossiness.floatValue, 0, 1); if (_Glossiness.floatValue < 0.01f) { tm.EnableKeyword("NO_DIRECT_SPECULAR"); } else { tm.DisableKeyword("NO_DIRECT_SPECULAR"); } // } } _emissionOnLightmap = EditorGUILayout.ToggleLeft("自发光影响Lightmap", _emissionOnLightmap); MaterialProperty _EmissionLightmapScale = FindProperty("_EmissionLightmapScale", properties); materialEditor.FloatProperty(_EmissionLightmapScale, "Lightmap中自发光强度"); } if (_isCharacter) { tm.EnableKeyword("EMISSION_ADJUSTMENT"); _rimLight = ShaderGUIUtils.ShaderKeywordToggle("边缘发光效果", _rimLight, "RIM_LIGHT", tm); if (_rimLight) { // MaterialProperty _RimColor = FindProperty("_RimColor", properties); // materialEditor.ColorProperty(_RimColor, "边缘发光颜色"); // MaterialProperty _RimFactor = FindProperty("_RimFactor", properties); // materialEditor.VectorProperty(_RimFactor, "边缘光参数 X: Y: Z:范围 W:强度 "); } _deathDissolve = ShaderGUIUtils.ShaderKeywordToggle("死亡溶解效果", _deathDissolve, "DEATH_DISSOLVE", tm); if (_deathDissolve) { MaterialProperty _DissovleColor = FindProperty("_DissolveColor", properties); materialEditor.ColorProperty(_DissovleColor, "溶解边界颜色"); MaterialProperty _DissolveTex = FindProperty("_DissolveTex", properties); materialEditor.TexturePropertySingleLine(new GUIContent("溶解灰度贴图"), _DissolveTex); } } else { tm.DisableKeyword("EMISSION_ADJUSTMENT"); } if (_isEnv) { _breakable = ShaderGUIUtils.ShaderKeywordToggle("是否击碎物", _breakable, "IS_BREAKABLE", tm); if (_breakable) { MaterialProperty _BreakableDistance = FindProperty("_BreakableDistance", properties); materialEditor.FloatProperty(_BreakableDistance, "击碎物标记距离"); MaterialProperty _BreakableColor = FindProperty("_BreakableColor", properties); materialEditor.ColorProperty(_BreakableColor, "击碎物边缘颜色"); } } if (_isTerrain) { MaterialProperty _SpecMap = FindProperty("_SpecMap", properties); materialEditor.TexturePropertySingleLine(new GUIContent("L1 高光", "RGB - Spec"), _SpecMap); // L2 // EditorGUILayout.LabelField("地形用贴图区域"); MaterialProperty _MainTex1 = FindProperty("_MainTex1", properties); materialEditor.TexturePropertySingleLine(new GUIContent("L2 纹理", "RGB - diffuse"), _MainTex1); if (tm.GetTexture("_MainTex1") != null) { terrainCount = 2; } MaterialProperty _BumpMap1 = FindProperty("_BumpMap1", properties); materialEditor.TexturePropertySingleLine(new GUIContent("L2 法线", "RGB - 法线"), _BumpMap1); MaterialProperty _SpecMap2 = FindProperty("_SpecMap1", properties); materialEditor.TexturePropertySingleLine(new GUIContent("L2 高光", "RGB - Spec"), _SpecMap2); // L3 MaterialProperty _MainTex2 = FindProperty("_MainTex2", properties); materialEditor.TexturePropertySingleLine(new GUIContent("L3 纹理", "RGB - diffuse, A - 光滑度"), _MainTex2); if (tm.GetTexture("_MainTex2") != null) { terrainCount = 3; } MaterialProperty _BumpMap2 = FindProperty("_BumpMap2", properties); materialEditor.TexturePropertySingleLine(new GUIContent("L3 法线", "RGB - 法线"), _BumpMap2); MaterialProperty _SpecMap3 = FindProperty("_SpecMap2", properties); materialEditor.TexturePropertySingleLine(new GUIContent("L3 高光", "RGB - Spec"), _SpecMap3); MaterialProperty _SplatTex = FindProperty("_SplatTex", properties); materialEditor.TexturePropertySingleLine(new GUIContent("地形混合贴图", "RGB - 对应三个层次"), _SplatTex); } if (tm.GetTexture("_BumpMap") != null) { tm.EnableKeyword("_NORMALMAP"); } else { tm.DisableKeyword("_NORMALMAP"); } if (tm.GetTexture("_SpecGlossMap") != null) { tm.EnableKeyword("_SPECGLOSSMAP"); } else { tm.DisableKeyword("_SPECGLOSSMAP"); MaterialProperty _Glossiness = FindProperty("_Glossiness", properties); if (_Glossiness.floatValue < 0.01f) { tm.EnableKeyword("NO_DIRECT_SPECULAR"); } else { tm.DisableKeyword("NO_DIRECT_SPECULAR"); } } if (!_isTerrain) { MaterialProperty _EmissionColor = FindProperty("_EmissionColor", properties); if (_EmissionColor.colorValue.grayscale > 0.01f) { tm.EnableKeyword("_EMISSION"); tm.globalIlluminationFlags = (_emissionOnLightmap)?MaterialGlobalIlluminationFlags.BakedEmissive : MaterialGlobalIlluminationFlags.None; } else { tm.DisableKeyword("_EMISSION"); } } if (_isTerrain) { //Debug.Log("Terrain Count " + terrainCount); tm.DisableKeyword("IS_TERRAIN"); if (terrainCount == 1) { tm.EnableKeyword("ONE_LAYER"); tm.DisableKeyword("TWO_LAYER"); tm.DisableKeyword("THREE_LAYER"); } if (terrainCount == 2) { tm.DisableKeyword("ONE_LAYER"); tm.EnableKeyword("TWO_LAYER"); tm.DisableKeyword("THREE_LAYER"); } if (terrainCount == 3) { tm.DisableKeyword("ONE_LAYER"); tm.DisableKeyword("TWO_LAYER"); tm.EnableKeyword("THREE_LAYER"); } } tm.DisableKeyword("VIRTUAL_LIGHT_ON"); }
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) { //base.OnGUI(materialEditor, properties); Material mat = materialEditor.target as Material; if (!_initialized) { _animatedTexture = mat.IsKeywordEnabled("ANIMATED_TEXTURE"); _twoTexture = mat.IsKeywordEnabled("TWO_LAYER"); _maskTexture = mat.IsKeywordEnabled("MASK_TEXTURE"); _normalMap = mat.IsKeywordEnabled("NORMALMAP"); // _specularOn = mat.IsKeywordEnabled("SPECULAR_ON"); // _reflectionOn = mat.IsKeywordEnabled("REFLECTION_ON"); _vertexWaveOn = mat.IsKeywordEnabled("VERTEX_WAVE"); _turbulence = mat.IsKeywordEnabled("TURBULENCE"); _rimLight = mat.IsKeywordEnabled("RIM_LIGHT"); _rimTexture = mat.IsKeywordEnabled("RIM_TEXTURE"); // _dissolve = mat.IsKeywordEnabled("DISSOLVE"); dissolveMode = (DissolveMode)ShaderGUIUtils.GetMultiCompileKeywordIndex(dissolveKeywords, mat); // blendMode = (AlphaBlendMode)ShaderGUIUtils.GetMultiCompileKeywordIndex(blendKeywords, mat); // edgeColorMode = (EdgeColorMode)ShaderGUIUtils.GetMultiCompileKeywordIndex(edgeColorKeywords, mat); // uvDistortMode = (UVDistortMode)ShaderGUIUtils.GetMultiCompileKeywordIndex(distortKeywords, mat); // rimColorMode = (RimColorMode)ShaderGUIUtils.GetMultiCompileKeywordIndex(rimKeywords, mat); // lightMode = (FXLightMode)ShaderGUIUtils.GetMultiCompileKeywordIndex(lightKeywords, mat); } bool isSolid = mat.shader.name.Contains("Solid"); GUI.color = Color.yellow; EditorGUILayout.LabelField("渲染模式选项"); GUI.color = Color.white; BackBlendModeGUI(materialEditor, properties); //culling control MaterialProperty _Culling = FindProperty("_Culling", properties); _Culling.floatValue = EditorGUILayout.Popup("裁剪模式", (int)_Culling.floatValue, cullingOptions); //ztest MaterialProperty _ZTest = FindProperty("_ZTest", properties); int zt = (int)_ZTest.floatValue; if (zt != (int)CompareFunction.LessEqual && zt != (int)CompareFunction.Always && zt != (int)CompareFunction.GreaterEqual) { _ZTest.floatValue = (int)CompareFunction.LessEqual; } _ZTest.floatValue = EditorGUILayout.IntPopup("深度测试模式", (int)_ZTest.floatValue, depthTestOptions, depthTestValues); //render queue MaterialProperty _Queue = FindProperty("_Queue", properties); _Queue.floatValue = EditorGUILayout.Popup("渲染次序", (int)_Queue.floatValue, queueOptions); if ((int)_Queue.floatValue > 0) { mat.renderQueue = renderQueueValues[(int)_Queue.floatValue]; } else { mat.renderQueue = EditorGUILayout.IntField("Render Queue", mat.renderQueue); } EditorGUILayout.Space(); GUI.color = Color.yellow; EditorGUILayout.LabelField("材质属性选项"); GUI.color = Color.white; // lightMode = (FXLightMode)ShaderGUIUtils.MultiKeywordSwitch("受光模式", lightOptions, lightKeywords, (int)lightMode, mat); // if (lightMode != FXLightMode.None) // { // _specularOn = ShaderGUIUtils.ShaderKeywordToggle("打开高光", _specularOn, "SPECULAR_ON", mat); // if (_specularOn) // { // MaterialProperty _SpecularPower = FindProperty("_SpecularPower", properties); // _SpecularPower.floatValue = EditorGUILayout.FloatField("Spec. Power", _SpecularPower.floatValue); // MaterialProperty _SpecularColor = FindProperty("_SpecularColor", properties); // _SpecularColor.colorValue = EditorGUILayout.ColorField("Spec. Color", _SpecularColor.colorValue); // } // } // _reflectionOn = ShaderGUIUtils.ShaderKeywordToggle("打开反射", _reflectionOn, "REFLECTION_ON", mat); // if (_reflectionOn) // { // MaterialProperty _Reflectivity = FindProperty("_Reflectivity", properties); // _Reflectivity.colorValue = EditorGUILayout.ColorField("反射颜色", _Reflectivity.colorValue); // } _animatedTexture = ShaderGUIUtils.ShaderKeywordToggle("打开UV动画", _animatedTexture, "ANIMATED_TEXTURE", mat); EditorGUILayout.Space(); // if (isSolid) // { // MaterialProperty _Cutoff = FindProperty("_Cutoff", properties); // _Cutoff.floatValue = EditorGUILayout.Slider("Alpha Cutoff", _Cutoff.floatValue, 0, 1.1f); // } //color property always exists MaterialProperty _Color = FindProperty("_Color", properties); _Color.colorValue = materialEditor.ColorProperty(_Color, "Tint Color"); // MaterialProperty _AlphaBoost = FindProperty("_AlphaBoost", properties); // _AlphaBoost.floatValue = materialEditor.FloatProperty(_AlphaBoost, "Alpha增幅"); MaterialProperty _MainTex = FindProperty("_MainTex", properties); materialEditor.TextureProperty(_MainTex, "主贴图", true); _normalMap = ShaderGUIUtils.ShaderKeywordToggle("使用法线贴图", _normalMap, "NORMALMAP", mat); if (_normalMap) { MaterialProperty _BumpMap = FindProperty("_BumpMap", properties); materialEditor.TexturePropertySingleLine(new GUIContent("主法线贴图"), _BumpMap); } if (_animatedTexture) { MaterialProperty _MainTexMove = FindProperty("_MainTexMove", properties); _MainTexMove.vectorValue = materialEditor.VectorProperty(_MainTexMove, "主贴图运动参数 (XY, 速度, ZW, 没有用)"); } EditorGUILayout.Space(); _twoTexture = ShaderGUIUtils.ShaderKeywordToggle("使用第二张贴图", _twoTexture, "TWO_LAYER", mat); if (_twoTexture) { MaterialProperty _SubTex = FindProperty("_SubTex", properties); materialEditor.TextureProperty(_SubTex, "第二张贴图", true); // if (_normalMap) // { // MaterialProperty _MainNormalMap = FindProperty("_SubNormalMap", properties); // materialEditor.TexturePropertySingleLine(new GUIContent("第二张法线贴图"), _MainNormalMap); // } if (_animatedTexture) { MaterialProperty _SubTexMove = FindProperty("_SubTexMove", properties); _SubTexMove.vectorValue = materialEditor.VectorProperty(_SubTexMove, "第二贴图运动参数 (XY, 速度, ZW, 没有用)"); } } EditorGUILayout.Space(); _maskTexture = ShaderGUIUtils.ShaderKeywordToggle("使用Alpha遮罩", _maskTexture, "MASK_TEXTURE", mat); if (_maskTexture) { MaterialProperty _MaskTex = FindProperty("_MaskTex", properties); materialEditor.TextureProperty(_MaskTex, "遮罩贴图", true); } // EditorGUILayout.Space(); // rimColorMode = (RimColorMode)ShaderGUIUtils.MultiKeywordSwitch("边缘发光", rimOptions, rimKeywords, (int)rimColorMode, mat); // if (rimColorMode == RimColorMode.Simple) // { // MaterialProperty _RimPower = FindProperty("_RimPower", properties); // _RimPower.floatValue = EditorGUILayout.Slider("边缘发光指数", _RimPower.floatValue, 0, 100); // MaterialProperty _RimColor = FindProperty("_RimColor", properties); // materialEditor.ColorProperty(_RimColor, "边缘发光颜色"); // //MaterialProperty _CenterColor = FindProperty("_CenterColor", properties); // //materialEditor.ColorProperty(_CenterColor, "中心部分颜色"); // } // EditorGUILayout.Space(); // blendMode = (AlphaBlendMode)ShaderGUIUtils.MultiKeywordSwitch("透明度混合模式", blendOptions, blendKeywords, (int)blendMode, mat); // MaterialProperty _Hardness = FindProperty("_Hardness", properties); // if (blendMode == AlphaBlendMode.Dissolve) // { // MaterialProperty _DissolveOpacity = FindProperty("_DissolveOpacity", properties); // _DissolveOpacity.floatValue = EditorGUILayout.Slider("整体透明度", _DissolveOpacity.floatValue, 0, 1); // _Hardness.floatValue = EditorGUILayout.FloatField("边缘硬度", _Hardness.floatValue); // } // if (blendMode == AlphaBlendMode.SampleTexture) // { // _Hardness.floatValue = EditorGUILayout.FloatField("边缘硬度", _Hardness.floatValue); // MaterialProperty _EdgeTex = FindProperty("_EdgeTex", properties); // materialEditor.TexturePropertySingleLine(new GUIContent("边缘色彩渐变贴图"), _EdgeTex); // } // if (blendMode != AlphaBlendMode.Blend) // edgeColorMode = (EdgeColorMode)ShaderGUIUtils.MultiKeywordSwitch("边缘色彩模式", edgeColorOptions, edgeColorKeywords, (int)edgeColorMode, mat); // EditorGUILayout.Space(); // uvDistortMode = (UVDistortMode)ShaderGUIUtils.MultiKeywordSwitch("UV坐标扭曲", distortOptions, distortKeywords, (int)uvDistortMode, mat); // if (uvDistortMode == UVDistortMode.Constant) // { // MaterialProperty _DistortParamX = FindProperty("_DistortParamX", properties); // _DistortParamX.vectorValue = materialEditor.VectorProperty(_DistortParamX, "坐标扭曲参数(U):x-振幅,yzw-没用"); // MaterialProperty _DistortParamY = FindProperty("_DistortParamY", properties); // _DistortParamY.vectorValue = materialEditor.VectorProperty(_DistortParamY, "坐标扭曲参数(V):x-振幅,yzw-没用"); // MaterialProperty _DistortTex = FindProperty("_DistortTex", properties); // materialEditor.TextureProperty(_DistortTex, "UV扭曲贴图(使用RG通道)", true); // if (_animatedTexture) // { // MaterialProperty _DistortTexMove = FindProperty("_DistortTexMove", properties); // _DistortTexMove.vectorValue = materialEditor.VectorProperty(_DistortTexMove, "UV扭曲贴图运动参数 (XY, 速度, ZW, 没有用)"); // } // } EditorGUILayout.Space(); _vertexWaveOn = ShaderGUIUtils.ShaderKeywordToggle("开启顶点波浪效果", _vertexWaveOn, "VERTEX_WAVE", mat); if (_vertexWaveOn) { MaterialProperty _VertexWaveMask = FindProperty("_VertexWaveMask", properties); materialEditor.TexturePropertySingleLine(new GUIContent("顶点波浪效果遮罩"), _VertexWaveMask); MaterialProperty _VertexWaveTex = FindProperty("_VertexWaveTex", properties); materialEditor.TexturePropertySingleLine(new GUIContent("顶点波浪效果强度"), _VertexWaveTex); MaterialProperty _VertexWaveCoord = FindProperty("_VertexWaveCoord", properties); materialEditor.VectorProperty(_VertexWaveCoord, "XY-U运动频率速度, ZW-V运动频率速度"); MaterialProperty _VertexWaveForce = FindProperty("_VertexWaveForce", properties); materialEditor.VectorProperty(_VertexWaveForce, "XYZ分别对应法线、切线、副法线的波动强度"); } EditorGUILayout.Space(); _turbulence = ShaderGUIUtils.ShaderKeywordToggle("开启纹理扰动效果", _turbulence, "TURBULENCE", mat); if (_turbulence) { MaterialProperty _Blend_Texture = FindProperty("_Blend_Texture", properties); materialEditor.TexturePropertySingleLine(new GUIContent("第一张混合纹理"), _Blend_Texture); MaterialProperty _Blend_Texture01 = FindProperty("_Blend_Texture01", properties); MaterialProperty _Color02 = FindProperty("_Color02", properties); materialEditor.ColorProperty(_Color02, "第一张纹理颜色"); materialEditor.TexturePropertySingleLine(new GUIContent("第二张混合纹理"), _Blend_Texture01); MaterialProperty _Speed_Brightness = FindProperty("_Speed_Brightness", properties); MaterialProperty _Color03 = FindProperty("_Color03", properties); materialEditor.ColorProperty(_Color03, "第二张纹理颜色"); materialEditor.VectorProperty(_Speed_Brightness, "XY:混合纹理流动速度, ZW:主纹理和混合效果强度"); } // EditorGUILayout.Space(); // _dissolve = ShaderGUIUtils.ShaderKeywordToggle("开启溶解效果", _dissolve, "DISSOLVE", mat); // if (_dissolve) // { // _dissolveParticle = ShaderGUIUtils.ShaderKeywordToggle("使用粒子顶点色", _dissolveParticle, "DISSOLVE_PARTICLE", mat); // MaterialProperty _Dissolve_Texture = FindProperty("_Dissolve_Texture", properties); // materialEditor.TexturePropertySingleLine(new GUIContent("溶解纹理"), _Dissolve_Texture); // MaterialProperty _Dissolve_ColorTex = FindProperty("_Dissolve_ColorTex", properties); // materialEditor.TexturePropertySingleLine(new GUIContent("颜色映射纹理"), _Dissolve_ColorTex); // MaterialProperty _DissolveParameters = FindProperty("_DissolveParameters", properties); // materialEditor.VectorProperty(_DissolveParameters, "X:溶解进度, Y:边缘宽度, Z:边缘亮度, W:缩放"); // } EditorGUILayout.Space(); dissolveMode = (DissolveMode)ShaderGUIUtils.MultiKeywordSwitch("溶解效果", dissolveOptions, dissolveKeywords, (int)dissolveMode, mat); if (dissolveMode == DissolveMode.Model) { MaterialProperty _Dissolve_Texture = FindProperty("_Dissolve_Texture", properties); materialEditor.TexturePropertySingleLine(new GUIContent("溶解纹理"), _Dissolve_Texture); MaterialProperty _Dissolve_ColorTex = FindProperty("_Dissolve_ColorTex", properties); materialEditor.TexturePropertySingleLine(new GUIContent("颜色映射纹理"), _Dissolve_ColorTex); MaterialProperty _DissolveParameters = FindProperty("_DissolveParameters", properties); materialEditor.VectorProperty(_DissolveParameters, "X:溶解进度, Y:边缘宽度, Z:边缘亮度, W:缩放"); } if (dissolveMode == DissolveMode.Particle) { MaterialProperty _DissolveParameters = FindProperty("_DissolveParameters", properties); materialEditor.VectorProperty(_DissolveParameters, "X:溶解度, Y:硬度, ZW:没用"); } EditorGUILayout.Space(); _rimLight = ShaderGUIUtils.ShaderKeywordToggle("开启边缘光效果", _rimLight, "RIM_LIGHT", mat); if (_rimLight) { MaterialProperty _RimColor = FindProperty("_RimColor", properties); _RimColor.colorValue = materialEditor.ColorProperty(_RimColor, "边缘光颜色"); _rimTexture = ShaderGUIUtils.ShaderKeywordToggle("使用贴图", _rimTexture, "RIM_TEXTURE", mat); if (_rimTexture) { MaterialProperty _Rim_Texture = FindProperty("_Rim_Texture", properties); materialEditor.TexturePropertySingleLine(new GUIContent("边缘光纹理"), _Rim_Texture); } MaterialProperty _RimParameters = FindProperty("_RimParameters", properties); materialEditor.VectorProperty(_RimParameters, "X:宽度, Y:亮度, ZW:没用"); } EditorUtility.SetDirty(mat); }