|
@@ -40,10 +40,13 @@ using Spine;
|
|
|
[CustomEditor(typeof(SkeletonAnimator))]
|
|
|
public class SkeletonAnimatorInspector : SkeletonRendererInspector {
|
|
|
protected SerializedProperty layerMixModes;
|
|
|
-
|
|
|
+ protected bool isPrefab;
|
|
|
protected override void OnEnable () {
|
|
|
base.OnEnable();
|
|
|
layerMixModes = serializedObject.FindProperty("layerMixModes");
|
|
|
+
|
|
|
+ if (PrefabUtility.GetPrefabType(this.target) == PrefabType.Prefab)
|
|
|
+ isPrefab = true;
|
|
|
}
|
|
|
|
|
|
protected override void gui () {
|
|
@@ -51,6 +54,18 @@ public class SkeletonAnimatorInspector : SkeletonRendererInspector {
|
|
|
|
|
|
EditorGUILayout.PropertyField(layerMixModes, true);
|
|
|
|
|
|
- serializedObject.ApplyModifiedProperties();
|
|
|
+ SkeletonAnimator component = (SkeletonAnimator)target;
|
|
|
+ if (!component.valid)
|
|
|
+ return;
|
|
|
+
|
|
|
+ EditorGUILayout.Space();
|
|
|
+
|
|
|
+ if (!isPrefab) {
|
|
|
+ if (component.GetComponent<SkeletonUtility>() == null) {
|
|
|
+ if (GUILayout.Button(new GUIContent("Add Skeleton Utility", SpineEditorUtilities.Icons.skeletonUtility), GUILayout.Height(30))) {
|
|
|
+ component.gameObject.AddComponent<SkeletonUtility>();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|