So I have this game board filled with buttons and they’re essentially all at arbitrary positions (well they’re in a hex grid but I don’t want anything based on this fact). What I want to do is make them all the children of a parent RectTransform or “panel”. This panel needs to automatically resize to best fit into its parent, maintaining its aspect ratio. But most importantly it needs to scale all of its children together. Almost as though all the children of the panel made up a single image attached to the panel gameobject.
TL;DR I want the scaling of a regular old Transform but I want it driven by the size of a RectTransform.
Wow this looks amazing!! I can’t thank you enough! Can’t wait to play with this. I knew what I was trying to accomplish was some pretty basic math but which basic math to use and how to apply it was eluding me. THANK YOU!!!
Oh btw did you make a youtube video? Doesn’t seem to load. Maybe it’s processing.
EDIT: Oh nevermind there it goes. AWESOME WOW MAN THANK YOOOUUUUU
I’m trying right now to figure this out myself. ReferenceResolution was of course the very first thing I tried but it always creates extra margin around the board or allows it to go off the screen if I change the screen aspect ratio. I can’t find any way to rig it so it doesn’t. Here’s a video showing what I mean.
Okay I think I have finally found how ReferenceResolution can be used to do what I wanted. The trick seemed to be to break the board out onto its own canvas with a ReferenceResolution that matches the size of the whole board when it’s the largest size it could be on my ReferenceResolution. In this case that happened to be 2048x2120. Then I set the Canvas Scale Mode to Expand and bingo, the behavior I wanted the whole time.
Still pretty mystified though. Probably need a copy of the source code to all these new UI components so I can actually see what the hell they’re doing lol.