From d3a38367e18696da780ffbed59231af339ffbebd Mon Sep 17 00:00:00 2001 From: pharan Date: Sun, 13 May 2018 03:20:01 +0800 Subject: [PATCH] [unity] Fix AnimationReferenceAsset inspector without SkeletonDataAsset. --- .../Editor/AnimationReferenceAssetEditor.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/spine-unity/Assets/spine-unity/Editor/AnimationReferenceAssetEditor.cs b/spine-unity/Assets/spine-unity/Editor/AnimationReferenceAssetEditor.cs index f91576888..596efbb42 100644 --- a/spine-unity/Assets/spine-unity/Editor/AnimationReferenceAssetEditor.cs +++ b/spine-unity/Assets/spine-unity/Editor/AnimationReferenceAssetEditor.cs @@ -63,8 +63,15 @@ namespace Spine.Unity.Editor { public override void OnInspectorGUI () { animationNameProperty = animationNameProperty ?? serializedObject.FindProperty("animationName"); string animationName = animationNameProperty.stringValue; - Animation animation = ThisSkeletonDataAsset.GetSkeletonData(true).FindAnimation(animationName); - bool animationNotFound = animation == null; + + Animation animation = null; + if (ThisSkeletonDataAsset != null) { + var skeletonData = ThisSkeletonDataAsset.GetSkeletonData(true); + if (skeletonData != null) { + animation = skeletonData.FindAnimation(animationName); + } + } + bool animationNotFound = (animation == null); if (changeNextFrame) { changeNextFrame = false;