Class XRBaseTargetFilter
Abstract base class from which all Target Filter behaviours derive. Instances of this class can be assigned to an XRBaseInteractor using the Inspector by setting the Starting Target Filter (startingTargetFilter). This serves as a serializable reference instead of using targetFilter which is not serialized.
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Filtering
Syntax
public abstract class XRBaseTargetFilter : MonoBehaviour, IXRTargetFilter
Properties
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.
Declaration
public virtual bool canProcess { get; }
Property Value
Type | Description |
---|---|
Boolean |
Implements
Methods
Link(IXRInteractor)
Called by Unity when the given Interactor links to this filter. Use this to do any code initialization for the given Interactor.
Declaration
public virtual void Link(IXRInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | The Interactor being linked to this filter. |
Implements
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.
Declaration
public abstract void Process(IXRInteractor interactor, List<IXRInteractable> targets, List<IXRInteractable> results)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | The linked Interactor whose Interactable candidates (or targets) are being filtered. |
List<IXRInteractable> | targets | The read only list of candidate Interactables to filter. This list should not be modified. |
List<IXRInteractable> | results | The results list to populate with the filtered results. This list should be sorted by priority (with highest priority first). |
Implements
Remarks
It's recommended to call this from an implementation of GetValidTargets(List<IXRInteractable>).
Unlink(IXRInteractor)
Called by Unity when the given Interactor unlinks from this filter. Use this to do any code cleanup for the given Interactor.
Declaration
public virtual void Unlink(IXRInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | The Interactor being unlinked from this filter. |