Search code examples
unity-game-engine2dshaderspriterenderer

Would like to know how expensive is SpriteRenderer.color as I am planning to use it to tint all of the sprites on my screen?


I am working on a 2D project and I need to change the tint of all sprites on the screen. I am planning to user SpriteRenderer's color property. But I am not sure if it will be cost-effective to do so or a shader will be a good choice. It is a sidescrolling platformer project and I don't want the framerate to drop significantly.

PS: I am planning to develop this game for mobile devices


Solution

  • In short yes this is a good and efficient way to set your sprites color. So you know setting the sprite render's color set the color on each vertex. The upside is less draw calls which is usually an issue on mobile especially android.

    It's always a good thing to double check your draw calls often by opening the Stats tab in the game view window (Batches). Changing color of individual sprites via the property shouldn't increment that number.