Search Unity

Saving memory by using a spritesheet, on a plane?

Discussion in '2D' started by elpuerco63, Nov 6, 2017.

  1. elpuerco63

    elpuerco63

    Joined:
    Jun 26, 2014
    Posts:
    271
    I have many 40+ files 512x512 and have my project loading each onto 40+ different planes and it works OK.

    I have now created a single file as a sprite sheet and setup using the sprite editor.

    But.....now I realise I cannot select the sprites to attache to each plane?

    Is it not possible to do this? a sprite sheet that contains 40+ sprites that I assign each sprite to an individual plane to save file loading resources?

    [Edit] Ah, the inspector says 2D and UI for sprites? Mmmm so no such thing for 3D?

    Thanks
     
  2. r3tNull

    r3tNull

    Joined:
    Apr 29, 2015
    Posts:
    51
    It works in 3d, however, you can't use the "sprite editor" to do this. You will need to select the entire sprite sheet in your diffuse material then adjust the tiling and offset variables to your needs.
     
    elpuerco63 likes this.
  3. elpuerco63

    elpuerco63

    Joined:
    Jun 26, 2014
    Posts:
    271
    Thanks, works a treat :)
     
  4. r3tNull

    r3tNull

    Joined:
    Apr 29, 2015
    Posts:
    51
    For tiling:

    Take the size of the SPRITE and divide it by the size of the IMAGE.
    (512 / 1024) = .5

    For Offset:

    This is the lower left corner of the texture (similar to uv mapping). You need to adjust this to be at the normalized position of the lower left corner of the sprite. (from 0.0 to 1.0).

    ---

    I'm glad you got it working!
     
    elpuerco63 likes this.
  5. elpuerco63

    elpuerco63

    Joined:
    Jun 26, 2014
    Posts:
    271

    Thanks for great help :):):)