How can I know when an AnimationTrack is loaded?

My problem is that whenever I do AnimationController:LoadAnimation(anim), there is some kind of waiting time while the animation is loading before I can do :GetTimeOfKeyframe(). I’m assuming it’s because it’s loading or something, at least. Anyone know a way I can tell almost exactly when the animation has loaded?

5 Likes

I recall something about checking if Length > 0, and otherwise wait until Length is set.

12 Likes

ohh good idea, i’ll look into that.

Shouldn’t there be a Loaded event in the AnimationTrack instance, similar to Sound.Loaded?

I feel like this is a missing property that should be added.

5 Likes

Didn’t even know there was that property for sounds. I think I’ll make a feature request soon for that then, but for now I’ll use the length checking method.

1 Like

Hi there again.

I have an enemy which loads all needed animations in a table upon spawning and I would then use the time of keyframe function whenever I need it after.

1 Like

i have an animation with length 0, just one keyframe :v

If your animation only has 1 keyframe, you don’t have the same problem as OP, there’s nothing to do after the animation has loaded anyway since the animationtrack will always be on the same pose once loaded. You likely wouldn’t be attaching events or timing to the keyframe since it’s a static pose.

3 Likes

of course there is else i wouldnt want it

It worked using ContentProvider:PreloadAsync() instead.