mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[spine-unity] Fix SkeletonDataAsset inspector error on recompile.
This commit is contained in:
parent
ccb9303681
commit
94df4cb5be
@ -62,10 +62,6 @@ namespace Spine.Unity.Editor {
|
|||||||
duration = serializedObject.FindProperty("duration");
|
duration = serializedObject.FindProperty("duration");
|
||||||
defaultMix = serializedObject.FindProperty("defaultMix");
|
defaultMix = serializedObject.FindProperty("defaultMix");
|
||||||
|
|
||||||
idlePlayButtonStyle = new GUIStyle(EditorStyles.toolbarButton);
|
|
||||||
activePlayButtonStyle = new GUIStyle(EditorStyles.toolbarButton);
|
|
||||||
activePlayButtonStyle.normal.textColor = Color.red;
|
|
||||||
|
|
||||||
#if SPINE_SKELETON_ANIMATOR
|
#if SPINE_SKELETON_ANIMATOR
|
||||||
controller = serializedObject.FindProperty("controller");
|
controller = serializedObject.FindProperty("controller");
|
||||||
#endif
|
#endif
|
||||||
@ -99,6 +95,16 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override public void OnInspectorGUI () {
|
override public void OnInspectorGUI () {
|
||||||
|
// Lazy initialization
|
||||||
|
{
|
||||||
|
// Accessing EditorStyles values in OnEnable during a recompile causes UnityEditor to throw null exceptions. (Unity 5.3.5)
|
||||||
|
idlePlayButtonStyle = idlePlayButtonStyle ?? new GUIStyle(EditorStyles.toolbarButton);
|
||||||
|
if (activePlayButtonStyle == null) {
|
||||||
|
activePlayButtonStyle = new GUIStyle(EditorStyles.toolbarButton);
|
||||||
|
activePlayButtonStyle.normal.textColor = Color.red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
serializedObject.Update();
|
serializedObject.Update();
|
||||||
|
|
||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
@ -115,7 +121,6 @@ namespace Spine.Unity.Editor {
|
|||||||
EditorGUILayout.PropertyField(skeletonJSON);
|
EditorGUILayout.PropertyField(skeletonJSON);
|
||||||
EditorGUILayout.PropertyField(scale);
|
EditorGUILayout.PropertyField(scale);
|
||||||
EditorGUILayout.Space();
|
EditorGUILayout.Space();
|
||||||
|
|
||||||
if (EditorGUI.EndChangeCheck()) {
|
if (EditorGUI.EndChangeCheck()) {
|
||||||
if (serializedObject.ApplyModifiedProperties()) {
|
if (serializedObject.ApplyModifiedProperties()) {
|
||||||
if (m_previewUtility != null) {
|
if (m_previewUtility != null) {
|
||||||
@ -133,9 +138,7 @@ namespace Spine.Unity.Editor {
|
|||||||
DrawAnimationList();
|
DrawAnimationList();
|
||||||
DrawSlotList();
|
DrawSlotList();
|
||||||
DrawUnityTools();
|
DrawUnityTools();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
#if !SPINE_TK2D
|
#if !SPINE_TK2D
|
||||||
// Reimport Button
|
// Reimport Button
|
||||||
using (new EditorGUI.DisabledGroupScope(skeletonJSON.objectReferenceValue == null)) {
|
using (new EditorGUI.DisabledGroupScope(skeletonJSON.objectReferenceValue == null)) {
|
||||||
@ -154,7 +157,7 @@ namespace Spine.Unity.Editor {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Application.isPlaying)
|
if (!Application.isPlaying)
|
||||||
serializedObject.ApplyModifiedProperties();
|
serializedObject.ApplyModifiedProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -830,7 +833,7 @@ namespace Spine.Unity.Editor {
|
|||||||
switch (current.GetTypeForControl(controlID)) {
|
switch (current.GetTypeForControl(controlID)) {
|
||||||
case EventType.ScrollWheel:
|
case EventType.ScrollWheel:
|
||||||
if (position.Contains(current.mousePosition)) {
|
if (position.Contains(current.mousePosition)) {
|
||||||
m_orthoGoal += current.delta.y;
|
m_orthoGoal += current.delta.y * 0.06f;
|
||||||
m_orthoGoal = Mathf.Max(0.01f, m_orthoGoal);
|
m_orthoGoal = Mathf.Max(0.01f, m_orthoGoal);
|
||||||
GUIUtility.hotControl = controlID;
|
GUIUtility.hotControl = controlID;
|
||||||
current.Use();
|
current.Use();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user