Hi! I’m making a 2D top-down game like old JRPGs.
To create my levels I use the Unity Tilemap component. I put a custom transparent sort axis on the Y-axis in the graphics settings so that sprites that are higher in the Y-axis are drawn behind sprites that are lower on the Y-axis.
Depending on the object I need to sort them from a different position. I think the way to do it is to change the pivot point since the pivot of the sprite is used to sort sprites on the y-axis.
My problem is that whenever I change the pivot point on a sprite, the sprites are not properly aligned on the tilemap. I know it’s possible to change the anchor of the tilemap but it would work only if every sprites had the same custom pivot point. In my case I would like to set a different custom point for many sprites to set properly, for each one of them, where the y-sort should happen.
Is that even possible using the Tilemap component from unity? Without creating many tilemaps for many custom pivot points?
I don’t think this is possible right now.
If possible, could you share some screenshots or pictures of your Sprites, their pivot points with the Tilemap so that we can better understand this issue and update the Editor? Thanks!
Hey!
I’m relatively new to Unity so I’m not sure how efficient this is to implement but I found a work around that seems to work for me but is rather tedious and would like to have at least the offset option in the Sprite Editor or perhaps a way to prevent the tile in the tile map from changing positions when pivot is changed.
As you mentioned when you change the pivot in the Sprite Editor it changes the position in the palette and subsequently its location on the scene.
to counteract this you can set an offset in the palette itself. (click the pointer and click on the tile that is off center, then set the offset to the equivalent of what you set the offset to, i.e. a normalized pivot of Y: -.5 would have a offset of Y:-1 since it would be shifted a whole unit up if everything else is set on a normal center pivot). It will be back in its original place in the palette when you have the correct offset to account for your new pivot.
The annoying point after this is that you now have to paint over all the shifted tiles with the new fixed offset tile. For some reason all tiles that have used this will not auto update to the new offset.
after this you will notice that items like a wall behind a chair should logically have pivots that line up and will no longer conflict with each other.
Please keep in mind that any TileMap that relies on the pivot sorting should have a mode of individual and not chunk. So it would be beneficial to keep large swath tiles that are fine just being on a separate layer to be on different tilemaps and kept on chunk. (i.e. floors and ceiling fixtures)
Unity Version: Unity 2022.1.14f1 (2D Core) Vanilla
2 Likes