- Home /
Does rapid layer changing affect performance?
Hi, in my script i every frame move quite a few objects to "Ignore Raycast" layer and then back to their original layer to prevent them being detected obviously. So i'm just wondering is it gonna affect performance a lot, especially for mobile. Personally i didn't noticed much difference in the profiler. Thank you!
You should simply create an intensive test to find out, and let us know the results.
Pile up a load of objects and have then all switch together each frame. See how long it takes in the profiler. Dont nest anything though, because that will give false results.
Answer by Obsessi0n · Feb 01, 2018 at 09:54 AM
I think having multiple layers don't affect performance that much because is just a way to reference things. But move object through layers every single frame I think it will affect performance. Check this it might help https://unity3d.com/pt/learn/tutorials/topics/physics/physics-best-practices