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

    Struct Sprite2DRendererHitBox2D

    Describes a 2D hit box for simple picking.

    Namespace: Unity.Tiny.HitBox2D
    Syntax
    public struct Sprite2DRendererHitBox2D : IComponentData
    Remarks

    This component behaves the same as a HitBox2D component, but a Sprite2DRenderer component defines its size.

    Fields

    pixelAccurate

    When true, the Sprite2DRendererHitBox2D component uses pixel-accurate hit testing from the sprite. Defaults to false.

    Declaration
    public bool pixelAccurate
    Field Value
    Type Description
    System.Boolean
    Remarks

    Pixel-accurate hit testing requires that the entity have both an Image2D component and an Image2DAlphaMask component attached before image loading. It ignores hits and overlap where the sprite Alpha is zero. Note that pixel-accurate hit testing is computationally intensive.

    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