Help me Choose the Correct Preset/Options

Hello everyone,

I have my game setup where there is a grid panel, and in it there are a bunch of grid cells, sort of like a chess board. There are options to change the board size etc., and it all works.

I want to have my UI flexible where this game can be played on different mobile phone screen sizes etc. so I need my grid panel and the cells inside it to be flexible. Right now when I resize my grid panel, the grid cell’s don’t change in size, how can I make it so that they will flawlessly stretch as I resize the grid panel? Please watch this short (30 sec) youtube video that I recorded which shows what is happening right now and how I want it to look like.

Note that I only achieve the correct movement when I select all the grid cells in editor, I want to be able to achieve that kind of movement/resizing as I resize the grid panel.

Thanks in advanced!

You need a geometry event then once you get the grid dimensions you have to adapt your elements dimensions by code. I wish it would be simpler but there is no way to say for example width = 10% then height = width other than by code.

That is what I went with! Not going to lie dealing with UI for mobile apps looks like a nightmare compared to PC. For PC I would design my UI for 1920x1080 and just scale that up and down. For mobile there are a million different layouts, and I am sure with a good enough design architecture they would work nicely but not for me :frowning:

For now I just fix things via script though

void Update()
{
    if(SystemInfo.deviceType != DeviceType.Handheld) return; // Only for mobile we do the resizing

    bool currentOrientationPortrait = Screen.orientation == ScreenOrientation.Portrait;

    if (Screen.orientation == ScreenOrientation.Portrait && 
        currentOrientationPortrait != lastOrientationPortrait) // This works (Gets the correct orientation correctly)
    {
        // Set screen up for portrait
    }
    else if (Screen.orientation == ScreenOrientation.Landscape && 
        currentOrientationPortrait != lastOrientationPortrait)
    {
        // Set screen up for landscape
    }

    lastOrientationPortrait = Screen.orientation == ScreenOrientation.Portrait;
}