Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Should I reuse Sprites?

Discussion in '2D' started by noatom, Apr 9, 2014.

  1. noatom

    noatom

    Joined:
    Apr 9, 2014
    Posts:
    21
    I want to make a 2D side scroller, and manually place every sprite. The problem is, if a level is long, it might have 900 sprites in it. I know that they get optimized pretty fast, so most of them are cut right at the CPU stage, but I still wonder about performance.

    Should I just have 20-30 sprites, and once one gets out of the screen(through the left side), place it in a new position again(reuse it?)

    Or I shouldn't be worried at all, and just use as many sprites as I need?
     
  2. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    for performance, you need to cull that 900 regardless if going on mobile or it will lose speed on trying to frustum cull it. Reuse is mostly to save ram.
     
  3. noatom

    noatom

    Joined:
    Apr 9, 2014
    Posts:
    21
    Yeah I'm going mobile...thats why I was worried since the beginning. On a device with 512mb ram nothing nice would happen with that amount of sprites.

    I'll find a way to reuse the same sprite for objects placed at different locations.