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

This commit is contained in:
Harald Csaszar 2020-10-28 16:00:54 +01:00
parent 88f403f5fc
commit 64dc6f66a4
2 changed files with 2 additions and 2 deletions

View File

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

View File

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