-
- ttermeer-reboundcg
- Posts: 31
- Joined:
- Contact:
Re: ComboBox and Mobile
So it seems the issue is how unity render the screen on mobile devices. NoesisGUI has the wrong size as Unity screen size is like 300-400 pixels while the native resolution is 2000+ pixels. This results in the viewbox doing weird result - which we observe if we try a resolution on PC that is below 500 pixels.
-
-
sfernandez
Site Admin
- Posts: 3363
- Joined:
Re: ComboBox and Mobile
The View size is affected by two parameters:
- In case of rendering to a Camera, we use the camera.pixelWidth and camera.pixelHeight provided by Unity. In case of rendering to a texture, then we use texture.width and texture.height.
- In case you have DPI enabled in the View component, then we apply the scale provided by Unity (Screen.dpi / 96.0f)
In mobile devices the DPI is usually high, so (if enabled) we end applying a 3x or even more scale to the view contents. So for example, if you launch the Simulator for a Samsung Galaxy S10, the screen resolution is 2280x1080, the DPI is 480 (scale of 5x), and the available space for the View contents will be 456x216.
This is useful when you want that a text with a FontSize=12 looks more or less in a similar physical size in a 27" monitor and in your 5" phone. If you don't want this behavior you can disable the DPI Scale option in the NoesisView component and you should deal with the different resolutions and DPIs as you want.
- In case of rendering to a Camera, we use the camera.pixelWidth and camera.pixelHeight provided by Unity. In case of rendering to a texture, then we use texture.width and texture.height.
- In case you have DPI enabled in the View component, then we apply the scale provided by Unity (Screen.dpi / 96.0f)
In mobile devices the DPI is usually high, so (if enabled) we end applying a 3x or even more scale to the view contents. So for example, if you launch the Simulator for a Samsung Galaxy S10, the screen resolution is 2280x1080, the DPI is 480 (scale of 5x), and the available space for the View contents will be 456x216.
This is useful when you want that a text with a FontSize=12 looks more or less in a similar physical size in a 27" monitor and in your 5" phone. If you don't want this behavior you can disable the DPI Scale option in the NoesisView component and you should deal with the different resolutions and DPIs as you want.
-
- ttermeer-reboundcg
- Posts: 31
- Joined:
- Contact:
Re: ComboBox and Mobile
Doesn't viewbox already take care of the font size?
Anyway , we tried without the DPI scale and it fixes the issue with the combo box!
Beside Fonts, is there anything we should check when disabling the DPI scale?
Anyway , we tried without the DPI scale and it fixes the issue with the combo box!
Beside Fonts, is there anything we should check when disabling the DPI scale?
-
-
sfernandez
Site Admin
- Posts: 3363
- Joined:
Re: ComboBox and Mobile
The difference between a Viewbox and DPI scaling is that in the first case a Viewbox scales everything accordingly to the Stretch value, which usually is Uniform. So in situations with different aspect ratios you can get undesired layouts (empty spaces around top-bottom, or left-right) as it won't be possible to entirely cover the whole screen. In the second case the DPI scale follows the same approach as the LayoutTransform, it reduces the available space of the content and then applies the scale, so different aspect ratios will stretch just fine without empty spaces. DPI scale is not exclusive of fonts, it affects all UI elements as a Viewbox will do.
If you see differences while using DPI scale it might be a symptom of incorrect use of Viewboxes producing incorrect layouts on different aspect ratios. The solution shouldn't be to disable the DPI, but to find if Viewbox is appropriate for what you're trying to achieve.
If you see differences while using DPI scale it might be a symptom of incorrect use of Viewboxes producing incorrect layouts on different aspect ratios. The solution shouldn't be to disable the DPI, but to find if Viewbox is appropriate for what you're trying to achieve.
-
- gjacob-RCG
- Posts: 8
- Joined:
Re: ComboBox and Mobile
Our game is designed in 16:9 format.
And we use viewbox so that whatever the screen, the UI remains in 16:9 format.
Yes, so we have empty bands appearing on the left/right if the screen format is not 16:9.
We've added gradients to frame the main UI.
We don't do responsive UI.
And we use viewbox so that whatever the screen, the UI remains in 16:9 format.
Yes, so we have empty bands appearing on the left/right if the screen format is not 16:9.
We've added gradients to frame the main UI.
We don't do responsive UI.
Who is online
Users browsing this forum: No registered users and 10 guests