Is there a way to unload AnimationTracks from Animators?
I am asking because my game is based on All-Star Cheerleading, and will have a lot of animations. I load the animations and put the tracks in a table.
The way I want it to work is selecting a skill type (e.g tumbling, stunting, jumps), and then the UI comes up with a list of all the skills and loads the animations so that when you press the button for that skill, it plays.
If you then switch skill type, it would unload all the animations on the animator and then load all the new ones of that skill type.
I’d just like to know if that’s possible
EDIT if not clear:
I just want to know if I can take an Animation TRACK and unload it.
You load it by doing
local track = Animator:LoadAnimation(AnimationObj)
I am wanting to know if deleting the track counts as unloading it from the Animator, as you can only have a maximum of 256 animations loaded onto an animator at once, and I will need more, so I need to unload tracks.
So you want an already finished animation (whoch you uploaded) To be back to the unpublished state which you could then edit? Thats not possible I think.
Oh why didn’t you say so earlier then I would’ve understood, you can clone the track and parent it in somewhere like repstorage/serverstorage, which gives it the illusion of being “destroyed”, then when you need it get it from repstorage.
Well yeah but that’s the closest you can do, because like you said you wanna use those tracks in the future. You can clone that track and then load the cloned one later.
Sort of like how people bring back a part to life, they hide it in repstorage/servstorage, and then they put it back in wrokspace. Not actually destroyed, an illusion.
I don’t think you’re understanding my problem.
There are a maximum of 256 tracks allowed to be loaded on an animator at once. My game will have a lot more than 256 animations, hence I want to be able to unload and load tracks at will.
You cannot clone and move a track to ServerStorage because it isn’t an in-game instance. It is just a variable in a script. And even if I could do that, it would not solve my issue because that “cloned” track is still LOADED onto the animator.
Yeah I just looked back and realised I was talking gibberish, english still isn’t my first language but i’m taking lessons to sorta understand it. I hope I’m making sense right now.
But yeah you can’t clone the tracks I realised, but you can destroy them
I think the “unloading” word got me confused, if you were just asking how to destroy them I wouldn’t have gotten confused.
But by the way “:Destroy()” is deprecated, instead use debris service to destroy the instance effectively:
local Debris = game:GetService("Debris")
Debris:AddItem(track, 0)