FIxed the bug that properpty drawer does not work well on the version less than unity 6.1

This commit is contained in:
2025-03-17 23:19:48 +09:00
parent dc1f1fb4e7
commit b12794270f
2 changed files with 7 additions and 7 deletions

View File

@@ -20,7 +20,7 @@ namespace Misaki.ShaderGUI
#if UNITY_6000_1_OR_NEWER #if UNITY_6000_1_OR_NEWER
return prop.propertyType == ShaderPropertyType.Float || prop.propertyType == ShaderPropertyType.Range || prop.propertyType == ShaderPropertyType.Int; return prop.propertyType == ShaderPropertyType.Float || prop.propertyType == ShaderPropertyType.Range || prop.propertyType == ShaderPropertyType.Int;
#else #else
return prop.type == MaterialProperty.PropType.Float || prop.type == MaterialProperty.PropType.Range || prop.type == MaterialProperty.PropType.Float; return prop.type == MaterialProperty.PropType.Float || prop.type == MaterialProperty.PropType.Range || prop.type == MaterialProperty.PropType.Int;
#endif #endif
} }

View File

@@ -9,7 +9,7 @@ namespace Misaki.ShaderGUI
{ {
private static readonly GUIContent[] _options = { new("Disabled"), new("Enabled") }; private static readonly GUIContent[] _options = { new("Disabled"), new("Enabled") };
protected virtual void OnPropertyChange(MaterialProperty prop) protected virtual void OnPropertyChanged(MaterialProperty prop)
{ {
} }
@@ -18,7 +18,7 @@ namespace Misaki.ShaderGUI
#if UNITY_6000_1_OR_NEWER #if UNITY_6000_1_OR_NEWER
return prop.propertyType == ShaderPropertyType.Float || prop.propertyType == ShaderPropertyType.Range || prop.propertyType == ShaderPropertyType.Int; return prop.propertyType == ShaderPropertyType.Float || prop.propertyType == ShaderPropertyType.Range || prop.propertyType == ShaderPropertyType.Int;
#else #else
return prop.type == MaterialProperty.PropType.Float || prop.type == MaterialProperty.PropType.Range || prop.type == MaterialProperty.PropType.Float; return prop.type == MaterialProperty.PropType.Float || prop.type == MaterialProperty.PropType.Range || prop.type == MaterialProperty.PropType.Int;
#endif #endif
} }
@@ -48,7 +48,7 @@ namespace Misaki.ShaderGUI
if (EditorGUI.EndChangeCheck()) if (EditorGUI.EndChangeCheck())
{ {
prop.floatValue = value; prop.floatValue = value;
OnPropertyChange(prop); OnPropertyChanged(prop);
} }
} }
else else
@@ -62,7 +62,7 @@ namespace Misaki.ShaderGUI
if (EditorGUI.EndChangeCheck()) if (EditorGUI.EndChangeCheck())
{ {
prop.intValue = value; prop.intValue = value;
OnPropertyChange(prop); OnPropertyChanged(prop);
} }
} }
@@ -74,7 +74,7 @@ namespace Misaki.ShaderGUI
{ {
private const string Keyword_Suffix = "_ON"; private const string Keyword_Suffix = "_ON";
protected override void OnPropertyChange(MaterialProperty prop) protected override void OnPropertyChanged(MaterialProperty prop)
{ {
var keywordName = prop.name.ToUpper() + Keyword_Suffix; var keywordName = prop.name.ToUpper() + Keyword_Suffix;
foreach (var target in prop.targets) foreach (var target in prop.targets)
@@ -109,7 +109,7 @@ namespace Misaki.ShaderGUI
_passName = passName; _passName = passName;
} }
protected override void OnPropertyChange(MaterialProperty prop) protected override void OnPropertyChanged(MaterialProperty prop)
{ {
foreach (var target in prop.targets) foreach (var target in prop.targets)
{ {