Here is a bit of code from the default Animate script for a character.
-- preload anims
for i, animType in pairs(animTable) do
for idx = 1, animType.count, 1 do
if PreloadedAnims[animType[idx].anim.AnimationId] == nil then
Humanoid:LoadAnimation(animType[idx].anim)
PreloadedAnims[animType[idx].anim.AnimationId] = true
end
end
end
I am curious, as to how this is actually preloading the animations?
The part Humanoid:LoadAnimaion() should be returning a track, right?
And since we are not storing the return value, does that mean the track will get GC’d at the end of this function?
Also, considering that elsewhere in the code, tracks are :Destroy(), does that instead mean the tracks are held up in memory somewhere, until the entire script is GC’d?
So they are GC as soon as they are returned with no reference, or at termination of function, or at termination of script?
Considering an AnimationTrack has a reference to the Animation Instance that it was loaded from, does that make any difference, could the Track remain in memory until the Animation Instance is destroyed?