using UnityEngine; using UnityEditor; public class LiquidSurfaceShaderGUI_Simplified : ShaderGUI { private static MaterialProperty P(string n, MaterialProperty[] p) => FindProperty(n, p, false); public override void OnGUI(MaterialEditor m, MaterialProperty[] props) { var surface = P("_SurfaceType", props); var mainTex = P("_MainTex", props); var baseCol = P("_BaseColor", props); var mainTexAlpha = P("_MainTexAlpha", props); // NOWE var smooth = P("_Smoothness", props); // NOWE // Water var tint = P("_WaterTint", props); var depth = P("_DepthStrength", props); var mainTexBlend = P("_MainTexBlend", props); var waveAmp = P("_WaveAmplitude", props); var waveLen = P("_WaveLength", props); var waveSpd = P("_WaveSpeed", props); var waveDir = P("_WaveDirection", props); var nTex = P("_NormalMap", props); var nStr = P("_NormalStrength", props); var sDet = P("_SurfaceDetail", props); var refr = P("_RefractionStrength", props); var fres = P("_FresnelStrength", props); var foamTex = P("_FoamTex", props); var foamStr = P("_FoamStrength", props); var foamBias = P("_FoamBias", props); var foamCol = P("_FoamColor", props); var normalScrollStr = P("_NormalScrollStrength", props); var foamScrollStr = P("_FoamScrollStrength", props); var n1Spd = P("_WaterNormal1Speed", props); var n2Spd = P("_WaterNormal2Speed", props); var foamSpd = P("_FoamScrollSpeed", props); var shoreStr = P("_ShorelineStrength", props); var shoreSharp= P("_ShorelineSharpness", props); var absorbStr = P("_AbsorptionStrength", props); // Lava var emis = P("_EmissionColor", props); var vScale = P("_VoronoiScale", props); var vThr = P("_VoronoiThreshold", props); var crackG = P("_LavaCrackGlow", props); var edgeG = P("_LavaEdgeGlow", props); var bDen = P("_BubbleDensity", props); var bFlow = P("_BubbleFlow", props); var bStr = P("_BubbleStrength", props); var bFade = P("_BubbleFade", props); // Vertex distortion var vStr = P("_VertexDistortStrength", props); var vSpd = P("_VertexDistortSpeed", props); EditorGUILayout.LabelField("Universal Liquid Surface (Simplified)", EditorStyles.boldLabel); if (surface != null) m.ShaderProperty(surface, "Surface Type"); EditorGUILayout.Space(); if (mainTex != null && baseCol != null) m.TexturePropertySingleLine(new GUIContent("Main Texture"), mainTex, baseCol); if (mainTexAlpha != null) m.ShaderProperty(mainTexAlpha, "MainTex Alpha Strength"); // NOWE if (smooth != null) m.ShaderProperty(smooth, "Smoothness"); // NOWE if (mainTexBlend != null) m.ShaderProperty(mainTexBlend, "MainTex Blend Strength"); if (normalScrollStr != null) m.ShaderProperty(normalScrollStr, "Normal Scroll Strength"); if (foamScrollStr != null) m.ShaderProperty(foamScrollStr, "Foam Scroll Strength"); EditorGUILayout.Space(); int mode = surface != null ? (int)surface.floatValue : 0; switch (mode) { case 0: // Water EditorGUILayout.LabelField("Color & Depth", EditorStyles.boldLabel); if (tint != null) m.ShaderProperty(tint, "Water Tint"); if (depth != null) m.ShaderProperty(depth, "Depth Strength"); EditorGUILayout.Space(); EditorGUILayout.LabelField("Waves", EditorStyles.boldLabel); if (waveAmp != null) m.ShaderProperty(waveAmp, "Amplitude"); if (waveLen != null) m.ShaderProperty(waveLen, "Length"); if (waveSpd != null) m.ShaderProperty(waveSpd, "Speed"); if (waveDir != null) m.ShaderProperty(waveDir, "Direction X,Y"); EditorGUILayout.Space(); EditorGUILayout.LabelField("Surface", EditorStyles.boldLabel); if (nTex != null) m.TexturePropertySingleLine(new GUIContent("Normal Map"), nTex); if (nStr != null) m.ShaderProperty(nStr, "Normal Strength"); if (sDet != null) m.ShaderProperty(sDet, "Surface Detail"); EditorGUILayout.Space(); EditorGUILayout.LabelField("Optics", EditorStyles.boldLabel); if (refr != null) m.ShaderProperty(refr, "Refraction Strength"); if (fres != null) m.ShaderProperty(fres, "Fresnel Strength"); EditorGUILayout.Space(); EditorGUILayout.LabelField("Foam", EditorStyles.boldLabel); if (foamTex != null) m.TexturePropertySingleLine(new GUIContent("Foam Texture"), foamTex, foamStr); if (foamBias != null) m.ShaderProperty(foamBias, "Foam Bias"); if (foamCol != null) m.ShaderProperty(foamCol, "Foam Color"); if (shoreStr != null) m.ShaderProperty(shoreStr, "Shoreline Strength"); if (shoreSharp!= null) m.ShaderProperty(shoreSharp, "Shoreline Sharpness"); EditorGUILayout.Space(); EditorGUILayout.LabelField("UV Scrolling", EditorStyles.boldLabel); if (n1Spd != null) m.ShaderProperty(n1Spd, "Normal 1 Speed (X,Y)"); if (n2Spd != null) m.ShaderProperty(n2Spd, "Normal 2 Speed (X,Y)"); if (foamSpd != null) m.ShaderProperty(foamSpd, "Foam Scroll Speed (X,Y)"); EditorGUILayout.Space(); EditorGUILayout.LabelField("Depth Absorption", EditorStyles.boldLabel); if (absorbStr != null) m.ShaderProperty(absorbStr, "Absorption Strength"); break; case 1: // Lava EditorGUILayout.LabelField("Lava Settings", EditorStyles.boldLabel); if (emis != null) m.ShaderProperty(emis, "Emission Color"); if (vScale != null) m.ShaderProperty(vScale, "Voronoi Scale"); if (vThr != null) m.ShaderProperty(vThr, "Voronoi Threshold"); if (crackG != null) m.ShaderProperty(crackG, "Crack Glow"); if (edgeG != null) m.ShaderProperty(edgeG, "Edge Glow"); EditorGUILayout.Space(); EditorGUILayout.LabelField("Procedural Bubbles", EditorStyles.boldLabel); if (bDen != null) m.ShaderProperty(bDen, "Bubble Density"); if (bFlow != null) m.ShaderProperty(bFlow, "Bubble Flow Speed"); if (bStr != null) m.ShaderProperty(bStr, "Bubble Strength"); if (bFade != null) m.ShaderProperty(bFade, "Bubble Fade Sharpness"); break; case 2: // Ice EditorGUILayout.LabelField("Ice Settings", EditorStyles.boldLabel); EditorGUILayout.HelpBox("Ice uses MainTex + BaseColor + Fresnel glow.", MessageType.Info); break; case 3: // River EditorGUILayout.LabelField("River Settings", EditorStyles.boldLabel); if (foamTex != null) m.TexturePropertySingleLine(new GUIContent("Foam Texture"), foamTex, foamStr); if (foamSpd != null) m.ShaderProperty(foamSpd, "Foam Scroll Speed (X,Y)"); if (foamCol != null) m.ShaderProperty(foamCol, "Foam Color"); break; } EditorGUILayout.Space(); EditorGUILayout.LabelField("Vertex Distortion (Global)", EditorStyles.boldLabel); if (vStr != null) m.ShaderProperty(vStr, "Distortion Strength"); if (vSpd != null) m.ShaderProperty(vSpd, "Distortion Speed"); } }