Skip to content

Commit 4325b71

Browse files
committed
Add editor property drawer for AnimatorParameter
1 parent 9914bfd commit 4325b71

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using UnityEditor;
2+
using UnityEngine;
3+
4+
namespace Zigurous.Animation.Editor
5+
{
6+
[CustomPropertyDrawer(typeof(AnimatorParameter))]
7+
public sealed class AnimatorParameterPropertyDrawer : PropertyDrawer
8+
{
9+
private SerializedProperty _name;
10+
11+
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
12+
{
13+
if (_name == null) {
14+
_name = property.FindPropertyRelative("_name");
15+
}
16+
17+
EditorGUI.BeginProperty(position, label, property);
18+
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
19+
_name.stringValue = EditorGUI.TextField(position, _name.stringValue);
20+
EditorGUI.EndProperty();
21+
}
22+
23+
}
24+
25+
}

Editor/AnimatorParameterPropertyDrawer.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)