As a Roblox developer, it is currently impossible to get the loaded animation tracks for a humanoid which are not playing.
If Roblox is able to address this issue, it would improve my development experience because I would easily be able to get an array of the humanoid’s loaded animations without having to previously set these as variables.
Current code:
local PlayingAnimations = this.Humanoid:GetPlayingAnimationTracks()
for _,track in pairs(PlayingAnimations) do
if track.Name == "RunAnim" then
warn("Running already...")
return
end
end
local runAnim = this.Humanoid:LoadAnimation(Animations.run.RunAnim)
runAnim:Play()
Code with new feature might look like:
local LoadedAnimations = this.Humanoid:GetLoadedAnimationTracks()
if LoadedAnimations.RunAnim.IsPlaying then
warn("Running already...")
return
end
LoadedAnimations.RunAnim:Play()
Support. This would be very great for single-player / splitscreen games that want to emulate pausing as if it were its own standalone game.
The option we have now is lacking because if there is an Animator script present and it changes the currently playing animation, there’s no real way to deal with that outside of forking the animator to return all loaded animations, which would force the developer to manually take charge of updating the Animator and reapplying changes if it ever receives an official update.
I’m not one to say this, but I reckon it wouldn’t be a major setback to implement if we’re able to get all playing animations. Maybe we can deprecate PlayingAnimationTracks for LoadedAnimationTracks.
Wow, six years! We gotta show this feature request some love. This would be a useful API for animators without us having to track loaded animations manually through some sort of wrapper class.
The mere existence of the suggested method implies that all the animation tracks that are not playing have to be tracked and kept in memory all the time for each animator. While I’m not 100% against the idea, it might have some implications like making some optimizations not possible and causing headaches for some developers. Also, it is not “impossible” right now.
If you ever feel the need of this method, you’re (probably) doing a bad practice.