Help troubleshooting: AnimationTrack limit of 256 tracks for one Animator exceeded, new animations will not be played

Does anyone have any tips to troubleshoot the error:
AnimationTrack limit of 256 tracks for one Animator exceeded, new animations will not be played.

I have gone through every script and made sure that each animation is loaded only once.

There are no tools to print a list of loaded animation tracks that I am aware of. There is only a way to print ‘playing’ animation tracks, which does not help in finding how many total are loaded.

GetPlayingAnimationTracks isn’t helpful for this issue.

4 Likes

You’re loading a new animation every single time they’re needed, have it loaded once outside of where it’s needed, then reuse the one that already exists when you need to. I don’t know if I explained this right.

2 Likes

I just said I load the animations only once. I store the track and use that to play subsequent replays.

1 Like

Can we see a script that causes this error? Like, does this mainly occur during a certain action? Can we see where you load in animations?

No we can’t because Roblox doesn’t tell you which script is causing it. It shows up in the error reports as a client warning with no script reference. Its not a very helpful warning message.

So I had to go through every script in my game and ensure that every animation is only loaded once, stored for later plays, and I have done this. The errors are greatly reduced but still I get some.

I went through all of my scripts again and can’t find any that use :loadanimation without storing the track and reusing it.

I was hoping someone knew of a way to display all loaded tracks in the Animator, but I don’t think that exists.

I made a module to store and load the tracks, this has cleared up 90% of these warnings that I was getting, but I still get some, which I don’t understand.

local loadedAnimation = AnimationRetriever.getLoadedAnimationTrack(character, holdbinoc, "binoc")

It won’t refrence a script, you have to see which one its firing from. For example, if you made a crouch script, and get the error after crouching too many times, that’s what you look at. Ofc it can be multiple, but figure out one script that has the problem and show us where you loaded the animation.

Yeah well I can’t reproduce the error, so I have no idea what script could be causing it. It doesn’t seem to happen to me when I play.

Is it fixed? If it isn’t happening you mustve fixed it, ish.

Small bump, but I have the same issue. I narrowed it down to the default animate script animations filling up the limit, dont know why though.

Anyone have any solution?

1 Like

No its not fixed, I just can’t reproduce the problem. I see it in the error reports coming from other clients.

1 Like

I did manage to find a script of mine(a few weeks ago prior to opening this thread) that was causing the default scripts to build up, but fixing that while reducing the problem significantly didn’t resolve it completely. This fix was related to a script I had that was applying :adjustweight to the default animations which was causing them to reload vs reuse. Getting rid of that adjustweight on all playing animations reduced the ‘256’ errors dramatically. But they are not gone.

I wish there were better tools for troubleshooting loaded animations, even if all it did was list all loaded animations that would be immensely helpful.

There is no reference in the documentation of a need to or method of destroying loaded animations.

1 Like

Unfortunately I dont have anything similar in my game with the weight thing.

For reference, you can just do this in a local script in starter character scripts:

local anim: Animator = script.Parent:WaitForChild("Humanoid"):WaitForChild("Animator")

function check()
	if #anim:GetPlayingAnimationTracks() > 256 then
		local tableString = ""

		for _, val: AnimationTrack in anim:GetPlayingAnimationTracks() do
			tableString ..= val.Animation.AnimationId..",\n"
		end

		warn("thats quite a lot of animations\n", tableString)
	end
end

anim.AnimationPlayed:Connect(check)

This would make a warning when the animation amount goes over the limit, and list all playing animations.

From what I found, the amount of LOADED animations doesnt actually count, just the amount thats actually playing is what matters. So its really weird that apparently 256 walk animations are playing at once (in my case).

EDIT: Did some more testing, here are some examples:
This would NOT cause the warning to appear:

local anim: Animator = script.Parent:WaitForChild("Humanoid"):WaitForChild("Animator")

task.wait(3)

for i = 1, 300 do
	local a = anim:LoadAnimation(script.Animation)
end

print("done?")

But this WOULD:

local anim: Animator = script.Parent:WaitForChild("Humanoid"):WaitForChild("Animator")

task.wait(3)

for i = 1, 300 do
	local a = anim:LoadAnimation(script.Animation)
	
	a:Play()
end

print("done?")

Cloning the animation every time you load it, but dont play it, also doesnt cause the warning.

2 Likes

Interesting, thanks for testing this. So, it seems from your testing that loaded animations can be ignored(for the purpose of this warning). So now I have to figure out how some players are getting 256 playing animations at once!

I’m not sure what benefit my animation loader/recycler is, knowing this. Unless its just for good memory management.

I tried to set that error trap, but it seems like it doesn’t work, I tested it with a low number and it worked fine but it doesn’t seem like the ‘experience’ error logs are recording it. For example, this warning here should have triggered the list warning but it didn’t:

The trap warning with a list of animations playing should have been show with this filter.

1 Like

I got a couple of errors captured, but the error report gui truncates it making it pretty much worthless:

no way to expand the error text or see the message. I was thinking of taking out the newlines but I don’t think that will help because it removed the newline anyway which would be before Animation1 in that screenshot.

Weird, it shows the full error for me, even if its like 250 lines long

Not sure if this will help in this scenario, but whenever I got to deal with animations, I simply use a function similar to below:

function loadTrack(animationId: string)
   -- Get the animator
   local animator = game:GetService("Players").LocalPlayer.Character.Humanoid.Animator -- Not ideal, but that's just for the example.
   -- Create the animation
   local animation = Instance.new("Animation")
   animation.AnimationId = animationId
   -- Load the animation
   local track = animator:LoadAnimation(animation)
   track:Play() -- I've seen people do this. I believe it's to pre-load the animation, so that there's no delay when it's actually used for the first time? Unsure.
   track:Stop()
   -- Return it.
   return track
end

-- Get the track.
local myAnimation = loadTrack(rbxassetid://123456789)
-- Play it.
myAnimation:Play()

This way, you ensure that you only create 1 animation track for the certain animation, and not overload the limit.
I know you mentioned that you have loaded the animations only once. However, from personal experience, this script has never let me down before.

For a more accurate troubleshooting, it would be helpful to show how you actually load an animation, or do a print() every time you’re creating a new animation.

Hope this helps!

1 Like

In the creator dashboard error log?

I can see the whole error in Studio, but I need to see it in the creator dashboard because I can’t reproduce the error in Studio. Its the creator dashboard that is truncating it.

I shortened the warning format so I could see more, it seems that its default Roblox animations that are stacking up which is weird, they’re not supposed to do that:

these are not any animations that I am playing specifically

Yeah I already went through all of my scripts to make sure I’m only loading any animation once then reusing it later as needed.

Thanks though.