public void OnInspectorGUI(StylisticFog.ColorSelectionType currentSelection, StylisticFog.FogColorSource colorSource) { if (properties.ContainsKey(currentSelection)) { foreach (var prop in properties[currentSelection]) { EditorGUILayout.PropertyField(prop); } } if (currentSelection == StylisticFog.ColorSelectionType.TextureRamp && colorSource.colorRamp != null) { List <string> warnings = new List <string>(); if (colorSource.colorRamp.filterMode == UnityEngine.FilterMode.Point) { warnings.Add("Texture filter mode should be either bilinear or trilinear."); } if (colorSource.colorRamp.wrapMode != UnityEngine.TextureWrapMode.Clamp) { warnings.Add("Texture wrap mode should be set to clamp."); } if (colorSource.colorRamp.mipmapCount > 1) { warnings.Add("Texture should not have generated mipmaps."); } if (warnings.Count() > 0) { string warningMSG = "The following settings should be applied to the color ramp texture:"; foreach (string warn in warnings) { warningMSG += "\n - " + warn; } EditorGUILayout.HelpBox(warningMSG, MessageType.Warning); } } }
public void OnInspectorGUI(StylisticFog.ColorSelectionType currentSelection, StylisticFog.FogColorSource colorSource, SerializedObject serializedObject) { EditorGUI.BeginChangeCheck(); if (properties.ContainsKey(currentSelection)) { foreach (var prop in properties[currentSelection]) { EditorGUILayout.PropertyField(prop); } } if (currentSelection == StylisticFog.ColorSelectionType.TextureRamp && colorSource.colorRamp != null) { List <string> warnings = new List <string>(); if (colorSource.colorRamp.filterMode == UnityEngine.FilterMode.Point) { warnings.Add("Texture filter mode should be either bilinear or trilinear."); } if (colorSource.colorRamp.wrapMode != UnityEngine.TextureWrapMode.Clamp) { warnings.Add("Texture wrap mode should be set to clamp."); } if (colorSource.colorRamp.mipmapCount > 1) { warnings.Add("Texture should not have generated mipmaps."); } if (warnings.Count() > 0) { string warningMSG = "The following settings should be applied to the color ramp texture:"; foreach (string warn in warnings) { warningMSG += "\n - " + warn; } EditorGUILayout.HelpBox(warningMSG, MessageType.Warning); } } if (EditorGUI.EndChangeCheck() && currentSelection == StylisticFog.ColorSelectionType.Gradient) { SerializedProperty gradientDirtyProp = serializedObject.FindProperty(path + ".m_GradientDirty"); if (gradientDirtyProp != null) { gradientDirtyProp.boolValue = true; } else { Debug.LogWarning(StylisticFog.m_EffectName + " Editor: Serialized property not found."); } } }