- Home /
How can i sort cards in a fixed width no matter how many card i have?
im making a cards game and i want the cards in player's hand to be sorted with fixed width, so if i have 5 cards or 20 cards they both won't exceed the fixed width but the spacing between them will be smaller. i tried doing it using Horizontal Layout but it didn't work, any tips?
Answer by Infenix · Aug 21, 2021 at 07:42 AM
The horizontal layout is what you want. Simply, it will start to do the wrong things if the content doesn't fit well the size of your card zone. Adding a content size fitter to all of your cards, which should be direct children of the layout group, should do what you want :)
https://docs.unity3d.com/2020.3/Documentation/Manual/script-ContentSizeFitter.html
i added a content size fitter to the cards and it still didnt behave correctly, and tried to check the control child size in the horizontal layout and it worked fine but when i added too much cards it went out of the range.
Do you have a discord account? maybe i can provide you with a video to help you understand what im ai$$anonymous$$g for.
Won't have much time to help you on discord but you can try, Infenix#7495
Your answer
Follow this Question
Related Questions
UI Cards, how to scale them properly ? 0 Answers
Card arrangement 1 Answer
Actions in a 2D Card Game 1 Answer
Get child name from another parent 2 Answers
Trading card game uniqe id generation 2 Answers