docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    Interface IXRTargetFilter

    An interface responsible to filter a list of Interactable targets (candidates) for interaction with a linked Interactor.

    Namespace: UnityEngine.XR.Interaction.Toolkit.Filtering
    Assembly: solution.dll
    Syntax
    public interface IXRTargetFilter
    Remarks

    An Interactor and an implementation of this interface are linked when a call to Link(IXRInteractor) happens and they are unlinked when a call to Unlink(IXRInteractor) happens. A linked Interactor can forward its Interactable target filtering logic to this interface implementation by calling Process(IXRInteractor, List<IXRInteractable>, List<IXRInteractable>).
    An XRBaseInteractor and a Target Filter can be linked when an implementation of this interface is assigned to targetFilter.
    It's possible to have multiple Interactors linked to the same Target Filter.

    Properties

    Name Description
    canProcess

    Whether this Target Filter can process and filter targets. Filters that can process targets receive calls to Process(IXRInteractor, List<IXRInteractable>, List<IXRInteractable>), filters that cannot process do not.

    Methods

    Name Description
    Link(IXRInteractor)

    Called by Unity when the given Interactor links to this filter. Use this to do any code initialization for the given Interactor.

    Process(IXRInteractor, List<IXRInteractable>, List<IXRInteractable>)

    Called by the linked Interactor to filter the Interactables that it could possibly interact with this frame. Implement your custom logic to filter the Interactable candidates in this method.

    Unlink(IXRInteractor)

    Called by Unity when the given Interactor unlinks from this filter. Use this to do any code cleanup for the given Interactor.

    See Also

    XRBaseTargetFilter
    XRTargetFilter
    GetValidTargets(List<IXRInteractable>)
    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)