Class XRTargetEvaluator
Abstract base class from which all Target Evaluators derive.
This class evaluates the intention to interact with an Interactable by calculating a score (a float value).
Used by the XRTargetFilter behavior which allows the list of valid targets returned by an Interactor
to be customized as determined by these evaluators.
Implements
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Filtering
Assembly: solution.dll
Syntax
[Serializable]
public abstract class XRTargetEvaluator : IDisposable
Remarks
All virtual and abstract methods in this class (Awake(), OnDispose(), OnEnable(), OnDisable(), Reset(), and CalculateNormalizedScore(IXRInteractor, IXRInteractable)) are designed to be called at specific moments and you shouldn't manually call them.
Properties
| Name | Description |
|---|---|
| disposed | (Read Only) Whether this evaluator was disposed. A disposed Target Evaluator has no use and you should not keep a reference to it. |
| enabled | Whether this Target Evaluator is enabled. Enabled evaluators are processed by its filter, disabled evaluators are not. |
| filter | (Read Only) The XRTargetFilter that owns this Target Evaluator. |
| weight | The weight curve of this evaluator. Use this curve to configure the returned value of the GetWeightedScore(IXRInteractor, IXRInteractable) method. |
Methods
| Name | Description |
|---|---|
| Awake() | Unity calls this automatically when the evaluator instance is being loaded. |
| CalculateNormalizedScore(IXRInteractor, IXRInteractable) | Calculates and returns a normalized value that represents the intention to select the given target Interactable.
|
| Dispose() | Call this to dispose this Target Evaluator. This removes the evaluator from its filter. After this call the evaluator has no use and you should not keep a reference to it. |
| GetWeightedScore(IXRInteractor, IXRInteractable) | The filter calls this method to get a value that represents the intention to select the given target Interactable. Gets the weighted interaction score, the y-axis value in the weight curve for an x-axis value returned by CalculateNormalizedScore(IXRInteractor, IXRInteractable). |
| OnDisable() | Unity calls this automatically when the evaluator becomes disabled. Use this method for any code cleanup. This is also called when the evaluator is disposed or when its filter is destroyed or disabled. |
| OnDispose() | Unity calls this automatically when the evaluator is being disposed. This is also called when the evaluator filter is destroyed. |
| OnEnable() | Unity calls this automatically when the evaluator becomes enabled and active. |
| Reset() | (Editor Only) Unity calls this automatically when adding the evaluator to the Filter Target the first time. This function is only called in the Unity editor. Reset is most commonly used to give good default values in the Inspector. |