User avatar
Paul Indrome
Topic Author
Posts: 6
Joined: 26 Mar 2022, 18:22

[Unity 2020.3.30f1, NoesisGUI 3.1.4] Is something about the DPI scaling broken?

27 Mar 2022, 23:35

I've been following along with the only actual use-case tutorial video I could find online, basically mirroring all actions taken exactly. It's been working much better than my first attempts at integrating NGUI to an existing project so far.

However, there seem to be some differences between version 3.1.1 used in the video and 3.1.4 currently downloadable here.

After setting up the initial UserControl objects the game view in the tutorial actually shows them at the top right with the correct margins.
Mine on the other hand only shows up when I maximize the gameplay window and then it's placed incorrectly as if the UserControl object of size 1334x780 wasn't scaled correctly to my Free Aspect window of about 1920x1080.

I was under the impression the DPI scaling would take care of this. However, nothing changes when it's enabled or disabled. Is there something wrong with it in 3.1.4?
 
User avatar
Paul Indrome
Topic Author
Posts: 6
Joined: 26 Mar 2022, 18:22

Re: [Unity 2020.3.30f1, NoesisGUI 3.1.4] Is something about the DPI scaling broken?

28 Mar 2022, 09:01

I was able to "fix" it on my own today but I am still wondering how the NoesisView "chooses" its resolution for a given aspect/game view situation.
Or, maybe more precisely, how Blend chooses the root object auto size when used with a Unity project & NoesisGUI.

Here is an album with pictures of the situation and the fix (images 1 - 4). Please note the image descriptions.
Last edited by Paul Indrome on 28 Mar 2022, 11:10, edited 1 time in total.
 
User avatar
jsantos
Site Admin
Posts: 4823
Joined: 20 Jan 2012, 17:18
Contact:

Re: [Unity 2020.3.30f1, NoesisGUI 3.1.4] Is something about the DPI scaling broken?

28 Mar 2022, 22:39

DPI scaling is a different thing. When DPI is enabled (in Unity 3.1.4 we added the option to disable DPI scaling by default and have the same behavior as in 3.0.X) physical pixels are converted into virtual pixels. So if you have a resolution of 1000x1000 at the root, and your device has 1.5 scaling, your 1000x1000 virtual pixels will be converted to 1500x1500 physical pixels. This allows applications to scale automatically with different DPI densities.

If you paste your XAML here I will try to help you more.
 
User avatar
Paul Indrome
Topic Author
Posts: 6
Joined: 26 Mar 2022, 18:22

Re: [Unity 2020.3.30f1, NoesisGUI 3.1.4] Is something about the DPI scaling broken?

29 Mar 2022, 12:12

Sure thing. Thank you for your help. :)

You may notice that the UserControl Width and Height seems set to specific values but actually both are set to (Auto) in Blend. If nothing else it would already help me to understand just HOW Blend chooses those specific numbers and why the resulting rendered view in game is vastly different in size just from a small deviation.
<UserControl
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:av="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="av" x:Class="FPS_Microgame_NeosisGUI.FPS_Microgame_NeosisGUIMainView"
  av:DesignHeight="752" av:DesignWidth="1356">
    <Grid>
        <ItemsControl Width="200" Height="200" Margin="10,10,10,10" HorizontalAlignment="Right" VerticalAlignment="Top" BorderBrush="#FFFB7F00" BorderThickness="5,5,5,5">
            <ItemsControl.Background>
                <RadialGradientBrush>
                    <GradientStop Color="#FF051B0A" Offset="1"/>
                    <GradientStop Color="#FF12521E" Offset="0"/>
                </RadialGradientBrush>
            </ItemsControl.Background>
        </ItemsControl>
    </Grid>
</UserControl>
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: [Unity 2020.3.30f1, NoesisGUI 3.1.4] Is something about the DPI scaling broken?

04 Apr 2022, 12:25

Hi Paul,

I'm not able to reproduce what you are explaining with latest 3.1.4 version. The behavior I see is that the UserControl fills the entire available space in the Game view (you can set a Background in the root Grid) and the ItemsControl (200x200 fixed size) is aligned to the top-right corner always. If I change the DPI on my monitor then the UI is accordingly scaled (when NoesisView DPI scale toggle is checked) and the ItemsControl remains aligned to the top-right corner.

Remember that Unity has also another scale slider that may hide part of the game view. Could that be what you were seeing?

Who is online

Users browsing this forum: Google [Bot] and 6 guests