Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I organize overlaping GameObjects in Layout Group in Unity?

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

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading