Show / Hide Table of Contents

Class ConstantPixelSize

A class that represents UnityEngine.UI.CanvasScaler.ScaleMode.ConstantPixelSize and its scaling properties.

Inheritance
Object
ConstantPixelSize
Namespace: Mux.Markup
Assembly: Mux.Markup.UI.dll
Syntax
public sealed class ConstantPixelSize : 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:ConstantPixelSize}" />
    <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 Constant Pixel Size mode, positions and sizes of UI elements are specified in pixels on the screen.
Unity - Scripting API: UI.CanvasScaler.ScaleMode.ConstantPixelSize
https://docs.unity3d.com/ScriptReference/UI.CanvasScaler.ScaleMode.ConstantPixelSize.html
        </mu:Text.Content>
    </mu:Text>
</m:RectTransform>

Fields

| Improve this Doc View Source

ScaleFactorProperty

Backing store for the ScaleFactor property.

Declaration
public static readonly BindableProperty ScaleFactorProperty
Field Value
Type Description
BindableProperty

Properties

| Improve this Doc View Source

ScaleFactor

A property that represents UnityEngine.UI.CanvasScaler.scaleFactor.

Declaration
public float ScaleFactor { get; set; }
Property Value
Type Description
Single

Methods

| Improve this Doc View Source

InitializeBodyInMainThread()

Declaration
protected override sealed void InitializeBodyInMainThread()
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX