I am currently trying to do a card game named "Durak". The cards overlap not how I want it to look like, you can't properly see value or suit sometimes: example of overlap. In the rules, there is no limit to how many cards you can hold in your hand during the game, so making larger gap between cards won't help. I have no idea how to make my cards to overlap like this: example of how i would want it to be like. Thank you.<3
CodePudding user response:
In case it's a 2D game and youre rendering sprites I recommend looking into Unity's docs page on 2D sorting,where they give multiple options.
For this case one of those options would be defining a Sorting Layer for the cards in hand and then changing the order in layer for each card(higher means rendered later,meaning itll be on top). You can access order in layer on the SpriteRenderer.
You can also go the more direct way of simply bringing things "closer" to the camera(this would work in 3d as well). One thing of note for 2d to be careful of here though,is that sprites are(if using the default shaders) rendered on the transparent que, and the project settings(Transparency Sort Mode) define the sorting of that transparent que for Orthographic cameras.
All this info is available in the docs here:
2D Sorting - https://docs.unity3d.com/Manual/2DSorting.html
SpriteRenderer - https://docs.unity3d.com/Manual/class-SpriteRenderer.html
Note: I am unsure of the completeness and readability of this answer,so if theres any questions /suggestions on improvement I'd greatly appreciate it,thanks.