docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    Method TryGetCurrentRaycast

    TryGetCurrentRaycast(out RaycastHit?, out int, out RaycastResult?, out int, out bool)

    Gets the first 3D and UI ray cast hits, if any ray cast hits are available.

    Declaration
    public bool TryGetCurrentRaycast(out RaycastHit? raycastHit, out int raycastHitIndex, out RaycastResult? uiRaycastHit, out int uiRaycastHitIndex, out bool isUIHitClosest)
    Parameters
    Type Name Description
    RaycastHit? raycastHit

    When this method returns, contains the ray cast hit if available; otherwise, the default value.

    int raycastHitIndex

    When this method returns, contains the index of the sample endpoint if a hit occurred. Otherwise, a value of 0 if no hit occurred.

    RaycastResult? uiRaycastHit

    When this method returns, contains the UI ray cast result if available; otherwise, the default value.

    int uiRaycastHitIndex

    When this method returns, contains the index of the sample endpoint if a hit occurred. Otherwise, a value of 0 if no hit occurred.

    bool isUIHitClosest

    When this method returns, contains whether the UI ray cast result was the closest hit.

    Returns
    Type Description
    bool

    Returns true if either hit occurred, implying the ray cast hit information is valid. Otherwise, returns false.

    TryGetCurrentRaycast(out RaycastHit?, out int, out RaycastResult?, out int, out bool, out ARRaycastHit?, out int, out bool)

    Gets the first 3D, AR and UI ray cast hits, if any ray cast hits are available.

    Declaration
    public bool TryGetCurrentRaycast(out RaycastHit? raycastHit, out int raycastHitIndex, out RaycastResult? uiRaycastHit, out int uiRaycastHitIndex, out bool isUIHitClosest, out ARRaycastHit? arRaycastHit, out int arRaycastHitIndex, out bool isARHitClosest)
    Parameters
    Type Name Description
    RaycastHit? raycastHit

    When this method returns, contains the ray cast hit if available; otherwise, the default value.

    int raycastHitIndex

    When this method returns, contains the index of the sample endpoint if a hit occurred. Otherwise, a value of 0 if no hit occurred.

    RaycastResult? uiRaycastHit

    When this method returns, contains the UI ray cast result if available; otherwise, the default value.

    int uiRaycastHitIndex

    When this method returns, contains the index of the sample endpoint if a hit occurred. Otherwise, a value of 0 if no hit occurred.

    bool isUIHitClosest

    When this method returns, contains whether the UI ray cast result was the closest hit.

    ARRaycastHit? arRaycastHit

    When this method returns, contains the AR ray cast hit if available; otherwise, the default value.

    int arRaycastHitIndex

    When this method returns, contains the index of the sample endpoint if a hit occurred. Otherwise, a value of 0 if no hit occurred.

    bool isARHitClosest

    When this method returns, contains whether the AR ray cast result was the closest hit.

    Returns
    Type Description
    bool

    Returns true if either hit occurred, implying the ray cast hit information is valid. Otherwise, returns false.

    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)