File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed
Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -6,28 +6,20 @@ namespace Zigurous.Graphics.Editor
66 [ CustomPropertyDrawer ( typeof ( ShaderProperty ) ) ]
77 public sealed class ShaderPropertyPropertyDrawer : PropertyDrawer
88 {
9- private SerializedProperty _name ;
10- private SerializedProperty _id ;
11-
129 public override void OnGUI ( Rect position , SerializedProperty property , GUIContent label )
1310 {
14- if ( _name == null ) {
15- _name = property . FindPropertyRelative ( "_name" ) ;
16- }
17-
18- if ( _id == null ) {
19- _id = property . FindPropertyRelative ( "_id" ) ;
20- }
11+ SerializedProperty name = property . FindPropertyRelative ( "_name" ) ;
12+ SerializedProperty id = property . FindPropertyRelative ( "_id" ) ;
2113
2214 EditorGUI . BeginProperty ( position , label , property ) ;
2315 position = EditorGUI . PrefixLabel ( position , GUIUtility . GetControlID ( FocusType . Passive ) , label ) ;
2416
25- string name = EditorGUI . TextField ( position , _name . stringValue ) ;
17+ string value = EditorGUI . TextField ( position , name . stringValue ) ;
2618
27- if ( name != _name . stringValue )
19+ if ( value != name . stringValue )
2820 {
29- _name . stringValue = name ;
30- _id . intValue = Shader . PropertyToID ( name ) ;
21+ name . stringValue = value ;
22+ id . intValue = Shader . PropertyToID ( value ) ;
3123 }
3224
3325 EditorGUI . EndProperty ( ) ;
You can’t perform that action at this time.
0 commit comments