I have always had some issues with understanding the fundamentals of playing animations, so excuse me if this is a very strange question. Here is my situation.
In my game, a player can morph into different creatures. When they morph, the physical model of the morph on the server (so all clients can see it) is cloned and parented to the character. Inside of the model is a local script, which has children animations. This script (client) sends the appropriate animations per the humanoid state to a client side animation player (not parented under the morph’s model, rather under the players character).
OK, I have animation tracks, from Animator loaded animations, purely on the client.
When a different morph gets applied, the model with the current morph is deleted, also the local script that handles passing animations to the client animation player. Then a new morph model is parented to the character and it all happens again.
So what happens is, I end up with animation tracks loaded from the Animator, that are not destroyed (or so I assume).
Is there a way to ‘unload’ or ‘remove’ the animations that are loaded onto an Animator, when you no longer need them, as in my case when a morph is removed?
If I store the tracks in the script that is destroyed with the change of morph, will destroyed tracks unload the animations? In other words does the Animator just keep a reference to ‘live’ animation tracks?
I could always use a remove event to have the server (which controls morphing) to send a list to the client of animation key’s and the client find those keys and destroy the tracks, but is that freeing up the Animator on the client if I were to do this? (Because I heard there is a limit)
Sorry for the long post, any help is appreciated. Thanks.
Alos… I don’t want to delete all tracks, considering the morph will not replace all animations, so if I remove all non playing ones, I will be removing the defaults that the default Roblox Animation script is using, also the same with the Animator, the default Roblox script, might not like that.