LuxURPCustomWaterShaderGUI.__cs 901 B

123456789101112131415161718192021222324252627
  1. using UnityEngine;
  2. using UnityEditor;
  3. public class LuxURPCustomWaterShaderGUI : ShaderGUI
  4. {
  5. public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
  6. {
  7. base.OnGUI(materialEditor, properties);
  8. Material material = materialEditor.target as Material;
  9. MaterialProperty _EnableRefraction = ShaderGUI.FindProperty("_EnableRefraction", properties);
  10. if (_EnableRefraction.floatValue == 1.0f) {
  11. material.SetFloat("_DstBlend", 0.0f);
  12. }
  13. else {
  14. material.SetFloat("_DstBlend", 10.0f);
  15. }
  16. // Needed to make the Selection Outline work
  17. if (material.HasProperty("_MainTex") && material.HasProperty("_BaseMap") ) {
  18. if (material.GetTexture("_BaseMap") != null) {
  19. material.SetTexture("_MainTex", material.GetTexture("_BaseMap"));
  20. }
  21. }
  22. }
  23. }