Renderer / sorting group limit?

Today we encountered the following error when instantiating few more prefabs than usual in our UI:

“Number of renderers and sorting groups handled (4111) is greater than the limit (4095), Sorting Group is disabled.”

It seems quite a lot of sorting groups got disabled, because most of the UI looked messed up.

I’ve been googling and can’t find any information whatsoever relating to a max limit of renderers and sorting groups (which is it, even?).

If this is a hard limit imposed on sorting groups, then we probably have to stop using them, or we will hit that cap pretty soon.

Anyone able to clarify what’s going on?

Anyone?

That’s a lot of sorting groups. How many UI elements do you have?! And do you have a sorting group on every single object?

I think you might be the second person in history to hit the limit (and ask about it online), so I’m not sure what to say, other than yes, it’s probably a hard limit.

Not many at all, actually. We usually put one on the top-level object of larger UI prefabs. I did a count of active sorting groups in the scene when the error happened and it was around 40, so I suspect it has more to do with the number of renderers inside a sorting group. Number of active renderers in the scene was around 800.

Edit: this is why I’m asking if anyone has any information about this limit, because there’s literally no documentation whatsoever around it, and as far as I can tell it should not be happening.

We’ve also hit this limit. After some testing, I’ve found that a sorting group cannot contain more than 4’095 renderers and other sorting groups combined. You can create as many top-level sorting groups and renderers as you like (I tried 10’000s of groups and renderers) but each group is limited to only contain 4’095 renderers/groups.

The documentation doesn’t mention this limitation. It also never mentions that sorting order is limited to ±32’767.

Update: Disabled renderers/groups also count towards the limit.

1 Like

Thanks, @ Your answer was the only piece of information I have found due this topic.