LizzyFox
Topic Author
Posts: 4
Joined: 02 Nov 2023, 12:14

Content Scaler for Unity

18 Nov 2023, 16:34

Hello there!

I have implemented content scaler (like uGUI Canvas) for unity with support of reference width and height and some types of width/height matching (without any MonoBehaviour watchers). May be it will be usefull to someone ^^

Link https://gist.github.com/LizzyFox-code/4 ... 98c74f2979.
How to use:
1. Add content scaler style to Application resources.
2. Add content scaler into xaml code.
<UserControl x:Class="Testing.TestScreen"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:scaling="clr-namespace:NoesisGUI.Extensions.Scaling">
    <scaling:ContentScaler ReferenceWidth="1920" ReferenceHeight="1080" ContentMatchMode="MatchWidthOrHeight" MatchWidthOrHeight="0">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="64"/>
            </Grid.RowDefinitions>

        </Grid>
    </scaling:ContentScaler>
</UserControl>
 
User avatar
sfernandez
Site Admin
Posts: 3064
Joined: 22 Dec 2011, 19:20

Re: Content Scaler for Unity

21 Nov 2023, 20:43

Thanks for sharing! It will be useful to others for sure.

Who is online

Users browsing this forum: Google [Bot], Semrush [Bot] and 12 guests