Hello Guest

Author Topic: Replace individual sprites in a SpriteCollection with a sprite sheet?  (Read 2277 times)

negative_zero

  • Newbie
  • *
  • Posts: 10
    • View Profile
Hi!

I have a SpriteCollection with 26 individual sprites that I am currently using in a TileMap.  I would like to replace those sprites with a single sprite sheet containing all 26 sprites, without having to go back and place everything again on the TileMap.  However, I can't figure out if this is possible.  If I go into my SpriteCollection and delete the old sprites and add the sprite sheet, the elements in the sprite sheet all have new Sprite IDs (which do not seem to be able to be edited), and I'm not sure how, if even possible, to get them to replace the old sprites instead of having new IDs and acting as totally separate sprites in the TileMap.

Is this possible?  If so, how?!

Thank You.


ComputerNerd

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Replace individual sprites in a SpriteCollection with a sprite sheet?
« Reply #1 on: October 01, 2016, 01:14:18 am »
You'll likely be fudging with the internal data, but I don't know the exact process.

What I learned the hard way myself is to store the tile maps separately from Unity through an external 3rd party package.  Tiled, for example, can be easily imported into the 2D Toolkit's Tile Map.  This way in the future if the sprite collection ever becomes corrupted or changes in an unforseen way your tile map won't be lost.  The resulting build files will also be smaller if you load these tmx files at runtime since the data won't be stored in the scene.