From 64dc6f66a492fc00dd17c387ff0ce2a734a9251b Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Wed, 28 Oct 2020 16:00:54 +0100 Subject: [PATCH] [unity] Added null check at Timeline SpineAnimationStateClip. Closes #1800. --- .../Runtime/SpineAnimationState/SpineAnimationStateClip.cs | 2 +- .../SpineAnimationState/SpineAnimationStateMixerBehaviour.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateClip.cs b/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateClip.cs index efa194f09..0ab9b18f4 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateClip.cs +++ b/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; } diff --git a/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs b/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs index d8051497b..17c998c95 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs +++ b/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}",