User avatar
stonstad
Topic Author
Posts: 241
Joined: 06 Jun 2016, 18:14
Location: Lesser Magellanic Cloud
Contact:

UIView Automatic DPI Scaling

04 Jan 2022, 17:44

In 3.1.x, automatic DPI scaling is added. This is a nice feature but it creates limitations because my application supports custom scaling which is user configurable. I am able to 'disable' Noesis automatic scaling by commenting out NoesisView line 1949, _uiView.SetScale().

- Is there a preferred approach for disabling DPI scaling?
- Alternatively, can support be added for custom scaling, whereby I set 1.0 as a default value if I wish to disable it?
- Does this DPI scaling feature adapt to screen resolution changes?

Thank you!
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: UIView Automatic DPI Scaling

10 Jan 2022, 17:41

Since 3.1 we are automatically setting the view scale to Screen.dpi in Unity. This takes into account pixel density. So for example, a resolution of 1024x1024 with 2x scale, will keep having a logical resolution of 1024 x 1024 but internally it is rendering to a 2048 x 2048 viewport. Note that this is not about screen resolution, changing the screen resolution will maintain the same scale.

This is implemented internally using a LayoutTransform at the root. Nothing stops you from having another LayoutTransform on your XAML with another scale for a user custom scale. Both effects will be cumulative.

Regarding disabling this in Unity, right now you need to change the code but I think we should add a flag in the Inspector. Could you please create a ticket about it?
 
User avatar
stonstad
Topic Author
Posts: 241
Joined: 06 Jun 2016, 18:14
Location: Lesser Magellanic Cloud
Contact:

Re: UIView Automatic DPI Scaling

10 Jan 2022, 19:18

Who is online

Users browsing this forum: No registered users and 76 guests