I’m trying to create a game overview (displaying healthbar, score etc) and have selected “Match Game View” in the “Canvas Size” component. I’m targeting phones in general (Android and perhaps later iPhone) and want all the elements displayed on the phone, regardless of the phone resolution (portrait mode though).
My understanding is, that most android phones use a 9:16 or 10:16 aspect ratio but the resolution is very different from device to device.
I scaled all my VisualElements in ‘px’ or ‘%’. I scale the text (font-size) in my Labels also with ‘px’, since this seemed the norm.
I’m getting some weird behaviour when i either use the emulator or just resizing the game view, but most noticeable is the scaling is off. On some devices the elements are all there, but sometimes i only see part of the screen as it seem to have grown (or shrunk depending on perspective) to not be able to show the rightmost or bottom most elements. Also on some resolutions, the fonts are too big, taking up too much space and in others they are too small to read. The last problem could be some bug in the game view window, but it could be that the font sizes in px are not scaled to match the resolution of the device?
I’m new to Unity (but feel very much at home with html/css using flexbox etc) but noticed something called Canvas Scaler for the old IMGUI (i think?). Is there something similar here or how can i cater for the different resolutions (also taking the different aspects into mind 9:16/10:16 in the devices) and perhaps also the “safe area” comming from the popular “notch screens”. I undersand the concept of pixels and px - that pixels are not scaleable, but the measure unit ‘px’ is actually scalable on the web from the browsers perspective…