浏览代码

[unity] Added null check at Timeline SpineAnimationStateClip. Closes #1800.

Harald Csaszar 4 年之前
父节点
当前提交
64dc6f66a4

+ 1 - 1
spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateClip.cs

@@ -47,7 +47,7 @@ namespace Spine.Unity.Playables {
 
 		public override double duration {
 			get {
-				if (template.animationReference == null)
+				if (template.animationReference == null || template.animationReference.Animation == null)
 					return 0;
 				return template.animationReference.Animation.Duration;
 			}

+ 1 - 1
spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs

@@ -141,7 +141,7 @@ namespace Spine.Unity.Playables {
 
 				var skeleton = skeletonComponent.Skeleton;
 
-				bool skeletonDataMismatch = clipData.animationReference != null &&
+				bool skeletonDataMismatch = clipData.animationReference != null && clipData.animationReference.SkeletonDataAsset &&
 					skeletonComponent.SkeletonDataAsset.GetSkeletonData(true) != clipData.animationReference.SkeletonDataAsset.GetSkeletonData(true);
 				if (skeletonDataMismatch) {
 					Debug.LogWarningFormat("SpineAnimationStateMixerBehaviour tried to apply an animation for the wrong skeleton. Expected {0}. Was {1}",