teavyr

hello,我正在Unity中做一个自定义窗口工具

如图:

QQ图片20190401142710.png


我想实现的功能是,将AnimationName变为一个下拉菜单,可选项是SpineAnimtionPrefab中Spine动画的动作名列表


就像在Inspector上这样:

QQ图片20190401144214.png



在EditorWindow中我使用的是 EditorGuiLayout.PropertyField();方法:

QQ图片20190401142720.png



现在的问题是请问,如何获得Spine Animation 动作名的SerializedProperty参数呢?
У вас нет необходимых прав для просмотра вложений в этом сообщении.
teavyr
  • Сообщения: 1

Harald

我在这里回答了重复的问题:
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"));
Аватара пользователя
Harald

Harri
  • Сообщения: 2410


Вернуться в 中国Spine用户