Hello! I work on a tiny indie gamedev team & have become familiar with Spine's Unity runtime internals over the years.
Today one of my artists encountered a problem to do with AnimationReferenceAsset. In cases where the asset winds up misconfigured (say due to regenerating the associated Spine's meta file), its skeletonDataAsset reference can become unhooked; and if an AnimationReferenceAsset with unhooked data winds up previewed in a timeline, the result is a whole lot of error spam as well as the timeline UI displaying no further tracks beyond when the exception occurred (causing artists to worry maybe there was catastrophic timeline data loss tho in this case there was none!)
The error spam emanates from the following subroutine within SpineAnimationStateClip:
public override double duration {
get {
if (template.animationReference == null)
return 0;
return template.animationReference.Animation.Duration;
}
}
Basically what happens is template.animationReference.Animation is null, and this 'duration' property gets sampled by unity's timeline code quite frequently leading to problems. I found I was able to prevent these issues from occurring by adding a second nullcheck to the above subroutine, such that it reads:
public override double duration {
get {
if (template.animationReference == null || template.animationReference.Animation == null)
return 0;
return template.animationReference.Animation.Duration;
}
}
I also had to change line 143 of SpineAnimationStateMixerBehaviour.cs so it includes a very similar nullcheck:
bool skeletonDataMismatch = clipData.animationReference && clipData.animationReference.SkeletonDataAsset &&
...
These changes seem to allow the timeline to stop glitching even while the AnimationReferenceAsset remains misconfigured/in need of fixing!
Any chance we could get this change into the official timeline extension package?