- Home /
Does a large number of layers affect performance?
Hi! i need to use layerculldistances for better performance so i need to create some extra layers. Right now there are not many models in the scene but when i add more into their respective layers then will it cause any frame rate drop due to objects being rendered in lot of different layers?
Thanks for reading!
Answer by oliver-jones · Feb 17, 2012 at 06:34 PM
@NOAA_Julien - Your link doesn't work.
I personally don't think they do. I've been working with games that have over 100 layers, and nothing is affected, its merely a way to reference things, so I don't see how it would effect performance.
Hope that helps
Oliver - the duplicate must have been deleted. Removing that comment.
I agree that they probably have no affect. All the code that uses layers does the check for layers regardless of whether you have 1 or 100, so there's no extra overhead for it to check and see that layer=1 vs layer=16.
Answer by Incode · Jan 13, 2020 at 07:07 PM
For posterity, the above answer may be referring to tags? The maximum number of layers is 32, and they most definitely have performance implications. For each layer in the matrix of layers, Unity must evaluate collisions based on every other layer. Here is an excellent blog post that goes into detail about the cost of layers: link