docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    Method GetCurrentGameObject

    GetCurrentGameObject(int)

    This will check the existing lists of pointer events and hand back the most current GameObject entered by the current pointer.

    Declaration
    public GameObject GetCurrentGameObject(int pointerId)
    Parameters
    Type Name Description
    int pointerId

    ID of the XR device pointer, mouse pointer or touch registered with the UIInputModule. Meaning this should correspond to either PointerEventData.pointerId or TrackedDeviceEventData.pointerId.

    Returns
    Type Description
    GameObject

    The GameObject that triggered the pointerEnter event.

    Remarks

    Any negative value used for pointerId will be treated as any. The first event in the from a tracked device will be used first, then to standard pointer devices such as mice and touchscreens.

    See Also
    IsPointerOverGameObject(int)
    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)