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
6
6
[ CustomPropertyDrawer ( typeof ( ShaderProperty ) ) ]
7
7
public sealed class ShaderPropertyPropertyDrawer : PropertyDrawer
8
8
{
9
- private SerializedProperty _name ;
10
- private SerializedProperty _id ;
11
-
12
9
public override void OnGUI ( Rect position , SerializedProperty property , GUIContent label )
13
10
{
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" ) ;
21
13
22
14
EditorGUI . BeginProperty ( position , label , property ) ;
23
15
position = EditorGUI . PrefixLabel ( position , GUIUtility . GetControlID ( FocusType . Passive ) , label ) ;
24
16
25
- string name = EditorGUI . TextField ( position , _name . stringValue ) ;
17
+ string value = EditorGUI . TextField ( position , name . stringValue ) ;
26
18
27
- if ( name != _name . stringValue )
19
+ if ( value != name . stringValue )
28
20
{
29
- _name . stringValue = name ;
30
- _id . intValue = Shader . PropertyToID ( name ) ;
21
+ name . stringValue = value ;
22
+ id . intValue = Shader . PropertyToID ( value ) ;
31
23
}
32
24
33
25
EditorGUI . EndProperty ( ) ;
You can’t perform that action at this time.
0 commit comments