docs.unity3d.com
    Show / Hide Table of Contents

    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.

    Inheritance
    Object
    XRTargetEvaluator
    XRLastSelectedEvaluator
    Inherited Members
    XRTargetEvaluator.filter
    XRTargetEvaluator.enabled
    XRTargetEvaluator.weight
    XRTargetEvaluator.disposed
    XRTargetEvaluator.Awake()
    XRTargetEvaluator.OnDispose()
    XRTargetEvaluator.OnEnable()
    XRTargetEvaluator.Reset()
    XRTargetEvaluator.GetWeightedScore(IXRInteractor, IXRInteractable)
    XRTargetEvaluator.Dispose()
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    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.
    It's a good practice to return a value between 0 and 1 inclusive and edit the weight curve to evaluate the target weighted interaction score.

    Overrides
    XRTargetEvaluator.CalculateNormalizedScore(IXRInteractor, IXRInteractable)
    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
    XRTargetFilter
    GetValidTargets(List<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.

    Declaration
    protected override void OnDisable()
    Overrides
    XRTargetEvaluator.OnDisable()
    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
    enabled

    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
    IXRTargetEvaluatorLinkable.OnLink(IXRInteractor)
    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)
    Link(IXRInteractor)

    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
    IXRTargetEvaluatorLinkable.OnUnlink(IXRInteractor)
    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
    OnLink(IXRInteractor)
    Unlink(IXRInteractor)
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023