Skip to content

Commit

Permalink
I am not smart
Browse files Browse the repository at this point in the history
  • Loading branch information
Nebby1999 committed Sep 7, 2024
1 parent 1e6a3bf commit 36e089f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### '5.0.4'

* Core Changes:
* ``SerializableShaderWrapperDrawer`` now uses ``nameof`` to avoid not finding the correct properties.

### '5.0.3'

* Core Changes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ internal class SerializableShaderWrapperDrawer : IMGUIPropertyDrawer<Serializabl
Object shaderObj = null;
protected override void DrawIMGUI(Rect position, SerializedProperty property, GUIContent label)
{
var shaderNameProp = property.FindPropertyRelative("_shaderName");
var shaderGUIDProp = property.FindPropertyRelative("_shaderGUID");
var shaderNameProp = property.FindPropertyRelative(nameof(SerializableShaderWrapper._shaderName));
var shaderGUIDProp = property.FindPropertyRelative(nameof(SerializableShaderWrapper._shaderGuid));

shaderObj = Shader.Find(shaderNameProp.stringValue);
if (!shaderObj)
Expand All @@ -25,6 +25,7 @@ protected override void DrawIMGUI(Rect position, SerializedProperty property, GU
{
shaderNameProp.stringValue = shaderObj == null ? string.Empty : ((Shader)shaderObj).name;
shaderGUIDProp.stringValue = shaderObj == null ? string.Empty : AssetDatabaseUtil.GetAssetGUIDString(shaderObj);
property.serializedObject.ApplyModifiedProperties();
}
EditorGUI.EndProperty();
}
Expand Down
4 changes: 2 additions & 2 deletions Editor/Core/SerializableShaderWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public Shader shader
}
}

[SerializeField] private string _shaderName;
[SerializeField] private string _shaderGuid;
[SerializeField] internal string _shaderName;
[SerializeField] internal string _shaderGuid;

/// <summary>
/// Creates a new instance of a SerializableShaderWrapper
Expand Down

0 comments on commit 36e089f

Please sign in to comment.