Search Unity

One texture multiple sprites

Discussion in '2D' started by m1smr, May 27, 2017.

  1. m1smr

    m1smr

    Joined:
    May 2, 2017
    Posts:
    5
    When I create multiple instances of a sprite with one texture does unity allocate the memory for only one texture or for all of them?

    And if it allocates memory for each of the sprites how can I avoid that?
     
  2. StormHerald

    StormHerald

    Joined:
    May 29, 2017
    Posts:
    17
    Well since it is a new instance, unity will allocate memory for the instance. also, you can't avoid making unity allocate memory for the sprites of each instance, if you did then the sprite wouldn't show at all! the best way to increase performance is to make sure your sprites are put into a sprite sheet. that way, unity only calls upon one image instead of different images for different sprites.