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

    Struct Sprite2DRendererOptions

    A modifier component, when added alongside a Sprite2DRenderer it overrides the world space size computation.

    Namespace: Unity.Tiny.Core2D
    Syntax
    [IdAlias("be2f221c9af74ec5c0a4495a2d6769a3")]
    public struct Sprite2DRendererOptions : IComponentData
    Remarks

    Regular sprites have a base (untransformed) size that is computed as image asset size times sprite pixelsToWorldUnits. When this component is added to an entity the base size is set explicitly, and the image is placed inside that region depending on the repeat mode.

    Fields

    drawMode

    Draw mode, defaults to ContinuousTiling. This mode specifies how the natural sized sprite is mapped into the new size.

    Declaration
    public DrawMode drawMode
    Field Value
    Type Description
    DrawMode

    size

    Sprite size in world units

    Declaration
    public float2 size
    Field Value
    Type Description
    float2
    Remarks

    This is used to override the computed natural sprite size. The natural size is Image2D.imagePixelSize * Sprite2D.pixelsToWorldUnits * Sprite2D.imageRegion.size. The new size is also used in hit testing.

    Properties

    Default

    Declaration
    public static Sprite2DRendererOptions Default { get; }
    Property Value
    Type Description
    Sprite2DRendererOptions
    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