2.5D Layering Issue

This is by no means a bug to clarify.

I’m making a 2.5D game and want to use only sprites with a 3D physics system. Right now it’s going well but I’ve bumped into a small hiccup.

The 2D sprites are flat and as a result the player while still standing on the 3D cube will pop behind the other sprite, I’ve been stumped trying to figure out a way to get them to appear in front without just flat out changing their sorting order since I do want them to appear behind objects if they’re beneath them.



Go read these pages for how to configure sorting axes for isometric tilemaps. Unity - Manual: 2D Sorting Unity - Manual: Creating an Isometric Tilemap . I am slightly worried about the part where you are talking about 3D physics and how you are connecting it 2d sprites, as that might mean slightly less standard setup, but it should still be possible to configure sorting axis to achieve desired result.

And some more reading to supplement what Karliss posted:

Three (3) ways that Unity draws / stacks / sorts / layers / overlays stuff:

In short,

  1. The default 3D Renderers draw stuff according to Z depth - distance from camera.

  2. SpriteRenderers draw according to their Sorting Layer and Sorting Depth properties

  3. UI Canvas Renderers draw in linear transform sequence, like a stack of papers

If you find that you need to mix and match items using these different ways of rendering, and have them appear in ways they are not initially designed for, you need to:

  • identify what you are using
  • search online for the combination of things you are doing and how to to achieve what you want.

There may be more than one solution to try.

Additional reading in the official docs:

Unity - Manual: 2D Sorting ← likely the same as Karliss posted above

And SortingGroups can also be extremely helpful in certain circumstances:

decrease the Z of your character based on current height

Z = y - height

make sure your tiles follow the same rule though youll need some offset
its hard to make it look good, if your sprite is too wide sometimes it will bleed through

you cant use the default unity collisions due to this

its your choice in the end if you want the hassle of making your own collisions