79373227

Date: 2025-01-21 04:56:40
Score: 1
Natty:
Report link

If you're using SpriteRenderers for the cards, you need to use settings such as Sorting Layer and Order in Layer rather than the Z position in the transform.

The higher the number, the closer the GameObject looks to the Camera. (docs)

SpriteRenderer sorting layer and order in layer

More info: https://discussions.unity.com/t/how-to-set-sprite-rendering-order-for-a-card-game/937796

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

Sprites draw according to Sorting Layer and Sorting Depth (properties of the Sprite Renderer)

There's also this if you want to get more sophisticated: Unity Manual - 2D Renderer Sorting

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Jan