Class XRLastSelectedEvaluator
The last selected target Interactable will receive the highest normalized score.
In the moment that an Interactable is selected by any of the linked Interactors, it'll have the highest normalized
score of 1
. Its normalized score will linearly decrease with time until the score reaches 0
after
maxTime seconds.
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Filtering
Syntax
[Serializable]
public class XRLastSelectedEvaluator : XRTargetEvaluator, IDisposable, IXRTargetEvaluatorLinkable
Properties
maxTime
Any Interactable which was last selected over Max Time seconds ago will receive a normalized score of 0
.
Declaration
public float maxTime { get; set; }
Property Value
Type | Description |
---|---|
Single |
Methods
CalculateNormalizedScore(IXRInteractor, IXRInteractable)
Calculates and returns a normalized value that represents the intention to select the given target Interactable.
The highest score of 1
represents the intention to select the given target and the lowest score of 0
the intention to not select it, any value in between is valid.
Declaration
protected override float CalculateNormalizedScore(IXRInteractor interactor, IXRInteractable target)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | The Interactor whose Interactable targets (candidates) are being evaluated. |
IXRInteractable | target | The target Interactable to evaluate the normalized score. |
Returns
Type | Description |
---|---|
Single | Returns the normalized interaction score of the given target.
|
Overrides
Remarks
The returned normalized score is evaluated by the weight curve (in GetWeightedScore(IXRInteractor, IXRInteractable)) and then
(in Process(IXRInteractor, List<IXRInteractable>, List<IXRInteractable>)) it's multiplied by the other evaluator weighted score in the same filter
to get the target final score.
You cannot disable, remove, or dispose evaluators from the filter in this method.
You also cannot unlink Interactors from the filter in this method.
See Also
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.
Declaration
protected override void OnDisable()
Overrides
Remarks
When scripts are reloaded after compilation has finished, OnDisable
will be called, followed by OnEnable
after the evaluator has been loaded.
OnDisable
will only be called if a call to OnEnable() happened before.
See Also
OnLink(IXRInteractor)
Called by the Target Filter when it links to the given Interactor.
This is also called after the evaluator's Awake() for each already linked Interactor.
Use this only for code initialization for the given Interactor.
Declaration
public virtual void OnLink(IXRInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | The Interactor being linked to the filter. |
Implements
Remarks
This is called even if the evaluator is disabled. You can check if the evaluator is enabled using the
enabled property.
You should not update the linked interactor list or the evaluator list in the filter, nor should you
disable or enable evaluators. This can lead to out-of-order calls to OnLink(IXRInteractor) and OnUnlink(IXRInteractor).
See Also
OnUnlink(IXRInteractor)
Called by the Target Filter when it unlinks from the given Interactor.
This is also called before the evaluator's OnDispose() for each linked Interactor.
Use this for any code cleanup for the given Interactor.
Declaration
public virtual void OnUnlink(IXRInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | The Interactor being unlinked from this filter. |
Implements
Remarks
This is called even if the evaluator is disabled. You can check if the evaluator is enabled using the
enabled property.
You should not update the linked interactor list or the evaluator list in the filter, nor should you
disable or enable evaluators. This can lead to out-of-order calls to OnLink(IXRInteractor) and OnUnlink(IXRInteractor).