Class ScaleWithScreenSize
A class that represents UnityEngine.UI.CanvasScaler.ScaleMode.ScaleWithScreenSize and its scaling properties.
Namespace: Mux.Markup
Assembly: Mux.Markup.UI.dll
Syntax
public sealed class ScaleWithScreenSize : CanvasScaler.Modifier
Examples
<m:RectTransform
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:m="clr-namespace:Mux.Markup;assembly=Mux.Markup"
xmlns:mu="clr-namespace:Mux.Markup;assembly=Mux.Markup.UI"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:playground="clr-namespace:Mux.Playground;assembly=Assembly-CSharp"
x:DataType="playground:PlaygroundViewModel">
<!--
Note that you can use "using" scheme instead of "clr-namespace" to omit assembly
specification if:
- the referenced type is in an assembly already loaded. (interpreter)
- the referenced type is in the assembly containing the compiled XAML. (compiler)
-->
<mu:StandaloneInputModule />
<mu:Canvas />
<mu:CanvasScaler UiScale="{mu:ScaleWithScreenSize}" />
<mu:GraphicRaycaster />
<mu:Text Font="{Binding Path=Resources.Font}">
<mu:Text.Content>
You have to give property name "Path" to Binding only when you compile
the interpreter with IL2CPP. It is because ContentPropertyAttribute does
not work with IL2CPP.
> Using the Scale With Screen Size mode, positions and sizes can be specified according to the pixels of a specified reference resolution.
> If the current screen resolution is larger than the reference resolution, the Canvas will keep having only the resolution of the reference resolution,
> but will scale up in order to fit the screen. If the current screen resolution is smaller than the reference resolution,
> the Canvas will similarly be scaled down to fit.
Unity - Scripting API: UI.CanvasScaler.ScaleMode.ScaleWithScreenSize
https://docs.unity3d.com/ScriptReference/UI.CanvasScaler.ScaleMode.ScaleWithScreenSize.html
</mu:Text.Content>
</mu:Text>
</m:RectTransform>
Fields
| Improve this Doc View SourceMatchWidthOrHeightProperty
Backing store for the MatchWidthOrHeight property.
Declaration
public static readonly BindableProperty MatchWidthOrHeightProperty
Field Value
Type | Description |
---|---|
BindableProperty |
ReferenceResolutionProperty
Backing store for the ReferenceResolution property.
Declaration
public static readonly BindableProperty ReferenceResolutionProperty
Field Value
Type | Description |
---|---|
BindableProperty |
ScreenMatchModeProperty
Backing store for the ScreenMatchMode property.
Declaration
public static readonly BindableProperty ScreenMatchModeProperty
Field Value
Type | Description |
---|---|
BindableProperty |
Properties
| Improve this Doc View SourceMatchWidthOrHeight
A property that represents UnityEngine.UI.CanvasScaler.matchWidthOrHeight.
Declaration
public float MatchWidthOrHeight { get; set; }
Property Value
Type | Description |
---|---|
Single |
ReferenceResolution
A property that represents UnityEngine.UI.CanvasScaler.referenceResolution.
Declaration
public UnityEngine.Vector2 ReferenceResolution { get; set; }
Property Value
Type | Description |
---|---|
UnityEngine.Vector2 |
ScreenMatchMode
A property that represents UnityEngine.UI.CanvasScaler.screenMatchMode.
Declaration
public UnityEngine.UI.CanvasScaler.ScreenMatchMode ScreenMatchMode { get; set; }
Property Value
Type | Description |
---|---|
UnityEngine.UI.CanvasScaler.ScreenMatchMode |
Methods
| Improve this Doc View SourceInitializeBodyInMainThread()
Declaration
protected override sealed void InitializeBodyInMainThread()