Correct way to update a sprite after editing master tilesheet

Hi

I have a sprite which is the basis for a tilemap.

I’ve had to make some edits to the sprite sheet to add a few extra sprites to it and also fix a few graphical issues.

What’s the correct way in Unity to update the sprite, and the associated tiles/tilemaps so that I don’t get the dreaded pink squares appearing?

Olly

1 Like

just make sure that the way your first imported the tilesheet into your assets, that the iteration over the single sprite tiles are the same and that your extensions comes afterwards, then you are good to go with that.
let’s say you’ve had some 4x4 tiles spritesheet.
if you had no custom outlining, but used the built-in slicing by gridsize or slicing by cellcount, then make sure you’ve added your additional tile at the very end of this spritesheet, making it e.g. 4x4 + one extra row with a tile at the bottom of the spritesheet or at the right side of your last tile in the last row.
unity is supped to import tiles from top-right corner to the right until it reaches end of line and then will move towards the next row and so on.

make sure you’ve backed up your project, before you do this, as you will try hard to revert everything if you break it, because the references to sprites might get lost and won’t be easily reverted if you then import it correctly later on.

trial and error ! :slight_smile:

Thanks. I’ve tried everything. I just can’t get it to update. Ultimately what seems to happen (or not happen) is that the list of Tiles never increases to reflect the additional sprites in the sprite sheet.

This is what my original palette looked like. The sprite sheet is the same. 16x16 grid of wall bits.

5186183--515291--Palette Before 1.png

This is what the new spritesheet looks like. I’ve added green wall bits.
5186183--515294--New Sprite 2.png

Once I save the PNG file over the sprite, and then use the Sprite Editor to cut the sprite sheet in to 16x16 cells the palette automatically shows something like this. The new sprites appear on top of the old ones. The actual number of 16x16 cells remains the same, despite the number of sprites changing.

5186183--515297--Palette After 3.png

This appears to be the cause. When I look at my Tiles in Unity, created when I first dragged the sprites to a palette, the number of Tiles hasn’t changed to reflect the new additions. No matter what I do I can’t get the new sprites to be added to the Tiles unless remove them all and start over, but then I get the pink-squares-of-death all over my maps as the expected wall pieces have changed.

Originall I had 35 tiles from that spritesheet in the palette. Afterwards I have 60 or so, but 35 are still shown in the Tiles node.

5186183--515300--Tile list 4.png

Any ideas? At this rate I’m going to have either get my sprites perfect at the start, or have a load of different palettes for each modification.

Olly

I’ve also tried editing the spritesheet so that the new sprites go on the right hand side of the old ones, above, below and to the left, and none of those combinations work.

I’ve also tried removing the empty sprite cells from the spritesheet so that there are no “blanks” but that doesn’t help either.

you are missing one important step and the knowledge its based on:
the tilepalette consists of tile assets, which are generated for you when you drag & drop a spritesheet into an tilepalette, when unity asks you where to store all the tiles.
so now that you substitute the existing spirtesheet with a new one, with some extension, unity still just knows about the references between the existing slices and the generated tile assets after you imported the first time.
so what you need to do is just multiselect all the new slices from the imported tilesheet and drag & drop them again into the existing tilepalette, then unity will ask you again where to store the tile assets.
afterwards you might need to rearrange the tiles in the tilepalette for the new tile assets you’ve just generated.
sounds complicates, but its not, because the important prerequisite of yours was to have not your actualy references lost and that would happen if you try to substitute or work around it another way.