Custom Physics Shape Doesn't Work On Tilemap

I trying to create custom colliders for my tilemap. I using the custom physics shape feature of sprite editor. But the problem is it's doesn't work on tilemap. It only creating basic square collider. Related images;

Note: I tried to reset the components of Tilemap gameobject but it doesn't work.

I watched this thread hoping someone would answer because I was having the same issue, though I've done some experimenting and found out some things.

One: Custom physics shapes with the aseprite importer seems to be broken. I ended up having to move my aseprite sprite sheets out of the project into a the working folder with other assets. Then export it as a png and set up the sprites with the sprite editor.

Two: It seems like if a tile is already in use by a TileBase (rule tile, tile, etc), then the physics shape doesn't seem to update when the physics shape changes. Though this was inconsistent. I would have to delete it's entry, create a new sprite entry in the sprite editor, and reassign the sprite to the TileBase it was being used by.

Sprites with custom physics shapes used in sprite renderers seem to update fine though.

So in the end a change to my asset pipeline (still very early in content creation, so only had to change a few things), and being careful with the order I did things in has addressed this. Though still a bit annoying.

Hope it helps.

1 Like


This has been fixed in Aseprite Importer 1.1.0. Let me know if you still have issues.

2 Likes


Ah, classic package manager not telling us there's an updated version with fixes to your specific problem...

I've just updated and will perhaps give a poke if I still have issues.

2 Likes

I actually still have exactly this issue.

2D Aseprite Importer 1.1.4, I can't get the physics shape to update in the tilemap even though I'm changing it in the sprite editor. I've tried everything I can think of.

The only thing that works is to remove the sprite's meta file, and set up all tiles from scratch + create collision shapes, then assign them to the tiles.

Just to throw in my experience: I noticed that when I changed a sprite's custom physics shape in the Sprite Editor in Unity, this change would not reflect on existing tilemaps. As soon as I deleted at least one tile in the tilemap, then the new shapes took effect.

This was with Unity 2023.3.25f1, but I wasn't using the Aesprite importer.

1 Like


If you still have a repro of this issue, do file a bug report and let me know the incident number, I would love to take a look at it.


The "outline" stored in the Sprite Asset is only used when tiles are first painted. The outline is used instead of using the Sprite Outline if it's present. Changing that doesn't instantly update every use of it everywhere; there's no links that the sprite has to know this either. Same with a PolygonCollider2D where you can edit the outline in it after the fact.

You should typically ensure your assets are set-up correctly including the "physics" outline. If you do change it when used for tiles, you'll have to cycle the TilemapCollider2D disable/enable.

The Tilemap could have a button to resend all the tiles to the TilemapCollider2D but that would effectively be the same as disable/enable on the TilemapCollider2D. The Tilemap is what controls what's in the TilemapCollider2D.

2 Likes

Thank you! I would not have been able to figure that out from the interface. But, a solution is a solution so now I know what to do :) Thank you!

I'd recommend a button both because of convenience, and the fact that it conveys how things actually work.

1 Like