- Изменено
如何在Unity EditorWindow中获取SpineAnimationName
hello,我正在Unity中做一个自定义窗口工具
如图:
我想实现的功能是,将AnimationName变为一个下拉菜单,可选项是SpineAnimtionPrefab中Spine动画的动作名列表
就像在Inspector上这样:
在EditorWindow中我使用的是 EditorGuiLayout.PropertyField();方法:
现在的问题是请问,如何获得Spine Animation 动作名的SerializedProperty参数呢?
我在这里回答了重复的问题:
I answered the duplicate question here:
How to get serializable Animation Name in EditorWindow?
用中文(表达:
In Chinese:
您可以像在SkeletonDebugWindow类中一样使用它,请参阅
http://esotericsoftware.com/git/spine-runtimes/spine-unity/Assets/Spine/Editor/spine-unity/Editor/SkeletonDebugWindow.cs#L261-L262
You can use it in the same way as in the class SkeletonDebugWindow, see
http://esotericsoftware.com/git/spine-runtimes/spine-unity/Assets/Spine/Editor/spine-unity/Editor/SkeletonDebugWindow.cs#L261-L262
所以在你的情况下:
So in your case:
var animationProperty = new SerializedObject(this).FindProperty("animationName");
EditorGUILayout.PropertyField(animationProperty, new GUIContent("Animation Name"));