I want to use OnBecameVisible on a parent object. This parent object has no image associated with it…only its children do. So I believe I need to add a renderer to the parent object, and just not attach any image to the renderer.
My question is, which is the cheapest renderer (performance wise)?
So I did a little benchmark on this, since I’ve just found myself in need of this information as well.
All the tests were profiled in the editor with the built-in profiler, on the same machine under the same conditions. So, with 16K empty renderers inside an empty scene, the results are as follows:
MeshRenderer: usually ~28ms on the CPU with 27ms lowest and 42ms highest.
SpriteRenderer: usually ~15ms on the CPU with 14ms lowest and 25ms highest.
SkinnedMeshRenderer: usually ~36ms on the CPU with 34ms lowest and 62ms highest.
LineRenderer: usually ~49ms on the CPU with 47ms lowest and 52ms highest.
TrailRenderer: usually ~36ms on the CPU with 29ms lowest and 40ms highest.
ClothRenderer: usually ~42ms on the CPU with 35ms lowest and 48ms highest.
So, apparently SpriteRenderer is the way to go!
Here’s a table (lower is better):