Search Unity

How to 'group sprites' to increase performance?

Discussion in '2D' started by scottstevens117, Jan 9, 2020.

  1. scottstevens117

    scottstevens117

    Joined:
    Oct 9, 2019
    Posts:
    2
    Hi there,

    I'm building a Colosseum scene for my mobile VR game, and using 2D sprites for the crowd (to maintain performance), but I'm still running at just 45fps, I want 60fps!

    I'm assuming the performance is hindered by the Sprite count, which sits at around 2000 because each crowd member is an individual sprite, however it is the same sprite for every audience member (a 2d picture of a man).

    Is there a way of increasing performance by grouping the sprites together into one Sprite? Would this increase performance? How would I go about doing it?

    Many thanks!
     
  2. LiterallyJeff

    LiterallyJeff

    Joined:
    Jan 21, 2015
    Posts:
    2,807
    Try using the FrameDebugger to see how your sprites are being rendered in a frame. Window > Analysis > Frame Debugger.

    If they are all using the same material and same sprite, they should be able to be drawn simultaneously using batching. The Frame Debugger should show you if that is the case, and give some reason why they are not being batched if that is the case.

    https://docs.unity3d.com/Manual/FrameDebugger.html

    You can also reduce overdraw by defining a custom sprite outline in the sprite editor, so the sprite mesh is very close to the shape of the sprite, leaving little transparent area around the border, reducing the amount of overlapping pixels that need to be rendered multiple times.

    Also use the profiler to see if it's not the rendering that is your bottleneck, but perhaps the way you update the 2000 sprites if they are animated, etc.