Struct UICanvas | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Struct UICanvas

    Root component for UI elements (entities with RectTransform and Transform components).

    Namespace: Unity.Tiny.UILayout
    Syntax
    public struct UICanvas : IComponentData

    Fields

    camera

    The entity with the Camera2D component used for layouting calculations.

    Declaration
    [EntityWithComponents(new Type[]{typeof(Camera2D)})]
    public Entity camera
    Field Value
    Type Description
    Entity

    matchWidthOrHeight

    Scales the Canvas to match the width or height of the reference resolution, or a combination of width and height.

    A value of 0 scales the Canvas according to the difference between the current screen resolution width and the reference resolution width.

    A value of 1 scales Canvas according to the difference between the current screen resolution height and the reference resolution height.

    Values between 0 and 1 scale the Canvas based on a combination of the relative width and height.

    Declaration
    public float matchWidthOrHeight
    Field Value
    Type Description
    System.Single

    referenceResolution

    The resolution the UI layout is designed for (in pixels).

    Declaration
    public float2 referenceResolution
    Field Value
    Type Description
    float2

    uiScaleMode

    How UI elements in the Canvas are scaled.

    Declaration
    public UIScaleMode uiScaleMode
    Field Value
    Type Description
    UIScaleMode

    Properties

    Default

    Declaration
    public static UICanvas Default { get; }
    Property Value
    Type Description
    UICanvas
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023