소스 검색

[unity] Fix AnimationReferenceAsset inspector without SkeletonDataAsset.

pharan 7 년 전
부모
커밋
d3a38367e1
1개의 변경된 파일9개의 추가작업 그리고 2개의 파일을 삭제
  1. 9 2
      spine-unity/Assets/spine-unity/Editor/AnimationReferenceAssetEditor.cs

+ 9 - 2
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;