- Home /
How do I set up my sprites/skeletons to correctly interact with isometric sorting layers?
What I am trying to do:
Use an Isometric Tilemap, have my characters walk behind and infront of stuff
I followed this old thread to set it up: https://forum.unity.com/threads/isometric-tilemap-sorting-issues.554914/
But, I do not know how to correctly set up my characters to not "sink" into the tilemaps. Some pictures to illustrate my problem, white box sprite "sinks" into tilemap: Moving behind stuff works perfectly fine, just the lower bound is wrong This is what the floor tile looks like in the tile palette, surface is aligned perfectly (or well enough, I guess) with the grid: From the other direction, as soon as the center of my character passes the center of the barrel tile, the barrel starts being drawn infront of my character (on this picture the floor tilemap is set to a background sorting layer, thats why there is no sinking. The barrel is on a different tilemap, on the same sorting layer as the character, thus causing a problem)
What I think is the problem:
As soon as the "center" of my sprite passes the center of the tile, the tile will be drawn over my character.
How do I change this "center" of my character?
In case it's relevant, the character is made out of Anima2D bones and meshes, but has a sorting group script attached. But I have the same problem with a simple 2D sprite as well.
Edit: Short gif to illustrate the current behaviour. As soon as the center of the white square goes above the center of the tile, the tile will be drawn infront of the square. I need to either move the center of the white square somehow, or the center of the tiles.
Answer by NikitaDemidov · Jan 09, 2019 at 07:19 PM
When you are pressing on the sprite in the inspector there is a "SpriteRenderer" in it you can find the field Order in Layer. Change the Number (when it is hight than you can see it in front of all the other Sprites , when it is low than you can see it behind of all the other Sprites).
I hope I UNDERSTOOD your answer correct and helped you.
No, that was not the problem. The character needs to be on the same Order in Layer as the tilemap. I added a gif to the question to illustrate it better.
Answer by chriseborn · Apr 20, 2020 at 08:54 AM
Did you ever figure out what was going on with this? I'm seeing the same thing in my scene.
Thanks C.
I did not find a solution. I accepted that free movement does not play nice with tilemaps, which seemed to be aimed at tile-by-tile movement games. I can not say if anything changed since then, I did not try for much longer.
Thanks @CalamaBanana ,
I got this working by rebuilding my scene and checking the things below>
Edit -> Project Settings -> Custom Sort Axis X=>0, Y=>1, Z=>0
Tilemap Settings, including $$anonymous$$ode => Individual and the Sorting Layer and Order in Layer
Character Sprite Setting, including setting the pivot to “Bottom” on all the characters sprites.
The PPU settings on the sprites for the Tilemap and Character and worked out how big things should be in game units, and then checked the transform Position and Scale were zero for both the character and the Tilemap.
As $$anonymous$$acbeth said: "I am in blood stepped in so far that should I wade no more, Returning were as tedious as go o’er,” .
Your answer
Follow this Question
Related Questions
How to stack(Sort?) objects (Trees in this case) in unity 2D TileMap 1 Answer
2D graphic problem with tilemap and resolution 0 Answers
Tile can't snap to another tile in tileset 1 Answer
How can i have my character be hidden behind tilemap walls? 0 Answers
2D isotiles. How to create the visual effect of walking up a ramp or a slope??? 0 Answers