Class Interactable
  
  Uses input and action data to declare a set of states
Maintains a collection of themes that react to state changes and provide sensory feedback
Passes state information and input data on to receivers that detect patterns and does stuff.
    Implements
    IMixedRealityFocusChangedHandler
    IMixedRealityFocusHandler
    IMixedRealityInputHandler
    IMixedRealitySpeechHandler
    IMixedRealityTouchHandler
    IMixedRealityInputHandler<Vector2>
    IMixedRealityInputHandler<Vector3>
    IMixedRealityInputHandler<MixedRealityPose>
   
  
  Assembly: cs.temp.dll.dll
  
  
    [Serializable]
public class Interactable : MonoBehaviour, IMixedRealityFocusChangedHandler, IMixedRealityFocusHandler, IMixedRealityInputHandler, IMixedRealitySpeechHandler, IMixedRealityTouchHandler, IMixedRealityInputHandler<Vector2>, IMixedRealityInputHandler<Vector3>, IMixedRealityInputHandler<MixedRealityPose>
   
  Fields
  
  
  
  
  Can the user deselect a toggle?
A radial button or tab should set this to false
Declaration
  
  Field Value
  
  
  
  
  Is the interactive selectable?
When a multi-dimension button, can the user initiate switching dimensions?
Declaration
  
  Field Value
  
  
  
  
  
  
  Declaration
  
  Field Value
  
  
  
  
  
  
  Declaration
  
    protected float clickTime
   
  Field Value
  
  
  
  
  
  
  Declaration
  
    protected Coroutine clickValidTimer
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | Coroutine |  | 
    
  
  
  
  
  
  
  Declaration
  
    protected int dimensionIndex
   
  Field Value
  
  
  
  
  A way of adding more layers of states for controls like toggles
Declaration
  
  Field Value
  
  
  
  
  The position of the controller when input down occurs.
Used to determine when controller has moved far enough to trigger gesture
Declaration
  
    protected Vector3? dragStartPosition
   
  Field Value
  
  
  
  
  Is the interactable enabled?
Declaration
  
  Field Value
  
  
  
  
  List of events added to this interactable
Declaration
  
    public List<InteractableEvent> Events
   
  Field Value
  
  
  
  
  
  
  Declaration
  
    protected readonly List<IMixedRealityPointer> focusingPointers
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | List<IMixedRealityPointer> |  | 
    
  
  
  
  
  
  
  Declaration
  
    protected bool forceUpdate
   
  Field Value
  
  
  
  
  
  
  Declaration
  
    protected float globalFeedbackClickTime
   
  Field Value
  
  
  
  
  
  
  Declaration
  
    protected Coroutine globalTimer
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | Coroutine |  | 
    
  
  
  
  
  
  
  Declaration
  
    protected List<IInteractableHandler> handlers
   
  Field Value
  
  
  
  
  Which action is this interactable listening for
Declaration
  
    public MixedRealityInputAction InputAction
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | MixedRealityInputAction |  | 
    
  
  
  
  
  
  
  Declaration
  
  Field Value
  
  
  
  
  Is the interactable listening to global events (input only)
Declaration
  
  Field Value
  
  
  
  
  
  
  Declaration
  
    protected bool isGlobalValueCheck
   
  Field Value
  
  
  
  
  
  
  Declaration
  
    protected State lastState
   
  Field Value
  
  
  
  
  
  
  Declaration
  
    public UnityEvent OnClick
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | UnityEvent |  | 
    
  
  
  
  
  
  
  Declaration
  
    protected readonly HashSet<IMixedRealityInputSource> pressingInputSources
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | HashSet<IMixedRealityInputSource> |  | 
    
  
  
  
  
  List of profiles can match themes with gameObjects
Declaration
  
    public List<InteractableProfileItem> Profiles
   
  Field Value
  
  
  
  
  Does the voice command require this to have focus?
Registers as a global listener for speech commands, ignores input events
Declaration
  
    public bool RequiresFocus
   
  Field Value
  
  
  
  
  
  
  Declaration
  
    protected bool requiresFocusValueCheck
   
  Field Value
  
  
  
  
  
  
  Declaration
  
    protected float rollOffTime
   
  Field Value
  
  
  
  
  
  
  Declaration
  
    protected float rollOffTimer
   
  Field Value
  
  
  
  
  
  
  Declaration
  
    protected List<ProfileSettings> runningProfileSettings
   
  Field Value
  
  
  
  
  The list of running theme instances to receive state changes
When the dimension index changes, the list of themes that are updated changes to those assigned to that dimension.
Declaration
  
    public List<InteractableThemeBase> runningThemesList
   
  Field Value
  
  
  
  
  The state logic for comparing state
Declaration
  
    public InteractableStates StateManager
   
  Field Value
  
  
  
  
  A collection of states and basic state logic
Declaration
  
  Field Value
  
  
  
  
  A voice command to fire a click event
Declaration
  
    public string VoiceCommand
   
  Field Value
  
  
  
  
  
  
  Declaration
  
    protected string[] voiceCommands
   
  Field Value
  
  
  
  
  
  
  Declaration
  
    protected bool wasDisabled
   
  Field Value
  
  Properties
  
  
  
  
  
  how many times this interactable was clicked
good for checking when a click event occurs.
Declaration
  
    public int ClickCount { get; }
   
  Property Value
  
  
  
  
  
  Does this interactable require focus
Declaration
  
    public bool FocusEnabled { get; set; }
   
  Property Value
  
  
  
  
  
  Pointers that are focusing the interactable
Declaration
  
    public List<IMixedRealityPointer> FocusingPointers { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | List<IMixedRealityPointer> |  | 
    
  
  
  
  
  
  Interactable is touching another object - custom: not set by Interactable
Declaration
  
    public bool HasCollision { get; }
   
  Property Value
  
  
  
  
  
  Misc - custom: not set by Interactable
Declaration
  
    public bool HasCustom { get; }
   
  Property Value
  
  
  
  
  
  
  
  Declaration
  
    public bool HasFocus { get; }
   
  Property Value
  
  
  
  
  
  Currently pressed and some movement has occurred
Declaration
  
    public bool HasGesture { get; }
   
  Property Value
  
  
  
  
  
  Gesture reached max threshold or limits - custom: not set by Interactable
Declaration
  
    public bool HasGestureMax { get; }
   
  Property Value
  
  
  
  
  
  A near interaction grabbable is actively being grabbed/
Declaration
  
    public bool HasGrab { get; }
   
  Property Value
  
  
  
  
  
  No focus, finger down - custom: not set by Interactable
Declaration
  
    public bool HasObservation { get; }
   
  Property Value
  
  
  
  
  
  Has focus, finger down - custom: not set by Interactable
Declaration
  
    public bool HasObservationTargeted { get; }
   
  Property Value
  
  
  
  
  
  A near interaction touchable is actively being touched
Declaration
  
    public bool HasPhysicalTouch { get; }
   
  Property Value
  
  
  
  
  
  
  
  Declaration
  
    public bool HasPress { get; }
   
  Property Value
  
  
  
  
  
  A voice command has occurred, this does not automatically reset
Can be reset using the SetVoiceCommand(bool) method.
Declaration
  
    public bool HasVoiceCommand { get; }
   
  Property Value
  
  
  
  
  
  
  
  Declaration
  
    protected static IMixedRealityInputSystem InputSystem { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | IMixedRealityInputSystem |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public bool IsDisabled { get; }
   
  Property Value
  
  
  
  
  
  No focus, finger is up - custom: not set by Interactable
Declaration
  
    public bool IsInteractive { get; }
   
  Property Value
  
  
  
  
  
  Has focus, finger up - custom: not set by Interactable
Declaration
  
    public bool IsTargeted { get; }
   
  Property Value
  
  
  
  
  
  True if SelectionMode is "Toggle" (Dimensions == 2) and the dimension index is not zero.
Declaration
  
    public bool IsToggled { get; }
   
  Property Value
  
  
  
  
  
  The Interactable has been clicked
Declaration
  
    public bool IsVisited { get; }
   
  Property Value
  
  
  
  
  
  Input sources that are pressing the interactable
Declaration
  
    public HashSet<IMixedRealityInputSource> PressingInputSources { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | HashSet<IMixedRealityInputSource> |  | 
    
  
  Methods
  
  
  
  
  
  Register OnClick extra handlers
Declaration
  
    public void AddHandler(IInteractableHandler handler)
   
  Parameters
  
  
  
  
  
  
  
  Declaration
  
    protected virtual void Awake()
   
  
  
  
  
  Based on button settings and state, should this button listen to input?
Declaration
  
    protected virtual bool CanInteract()
   
  Returns
  
  
  
  
  
  a public way to decrease the dimension
Declaration
  
    public void DecreaseDimension()
   
  
  
  
  
  Get the themes based on the current dimesionIndex
Declaration
  
    protected void FilterThemesByDimensions()
   
  
  
  
  
  
  
  Declaration
  
    public void ForceUpdateThemes()
   
  
  
  
  
  A public way to access the current dimension
Declaration
  
    public int GetDimensionIndex()
   
  Returns
  
  
  
  
  
  Returns a list of states assigned to the Interactable
Declaration
  
    public State[] GetStates()
   
  Returns
  
  
  
  
  
  Grabs the state value index
Declaration
  
    public int GetStateValue(InteractableStates.InteractableStateEnum state)
   
  Parameters
  
  Returns
  
  
  
  
  
  checks the voiceCommand array for a keyword and returns it's index
Declaration
  
    protected int GetVoiceCommandIndex(string command)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | command |  | 
    
  
  Returns
  
  
  
  
  
  Clears up any automated visual states
Declaration
  
    protected IEnumerator GlobalVisualReset(float time)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Single | time |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | IEnumerator |  | 
    
  
  
  
  
  
  a public way to increase a dimension, for cycle button
Declaration
  
    public void IncreaseDimension()
   
  
  
  
  
  internal dimension cycling
Declaration
  
    protected void IncreaseDimensionIndex()
   
  
  
  
  
  A timer for the MixedRealityInputHandlers, clicks should occur within a certain time.
Declaration
  
    protected IEnumerator InputDownTimer(float time)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Single | time |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | IEnumerator |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void OnBeforeFocusChange(FocusEventData eventData)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | FocusEventData | eventData |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void OnFocusChanged(FocusEventData eventData)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | FocusEventData | eventData |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void OnFocusEnter(FocusEventData eventData)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | FocusEventData | eventData |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void OnFocusExit(FocusEventData eventData)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | FocusEventData | eventData |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void OnInputChanged(InputEventData<MixedRealityPose> eventData)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | InputEventData<MixedRealityPose> | eventData |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void OnInputChanged(InputEventData<Vector2> eventData)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | InputEventData<Vector2> | eventData |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void OnInputChanged(InputEventData<Vector3> eventData)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | InputEventData<Vector3> | eventData |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void OnInputDown(InputEventData eventData)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | InputEventData | eventData |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void OnInputUp(InputEventData eventData)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | InputEventData | eventData |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void OnPositionInputChanged(InputEventData<Vector2> eventData)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | InputEventData<Vector2> | eventData |  | 
    
  
  
  
  
  
  Voice commands from MixedRealitySpeechCommandProfile, keyword recognized
requires isGlobal
Declaration
  
    public void OnSpeechKeywordRecognized(SpeechEventData eventData)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | SpeechEventData | eventData |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void OnTouchCompleted(HandTrackingInputEventData eventData)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | HandTrackingInputEventData | eventData |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void OnTouchStarted(HandTrackingInputEventData eventData)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | HandTrackingInputEventData | eventData |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void OnTouchUpdated(HandTrackingInputEventData eventData)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | HandTrackingInputEventData | eventData |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void RemoveHandler(IInteractableHandler handler)
   
  Parameters
  
  
  
  
  
  Reset all states in the Interactable and pointer information
Declaration
  
    public void ResetAllStates()
   
  
  
  
  
  Reset the basic interaction states
Declaration
  
    public void ResetBaseStates()
   
  
  
  
  
  Assigns the InputAction based on the InputActionId
Declaration
  
    public static MixedRealityInputAction ResolveInputAction(int index)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Int32 | index |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | MixedRealityInputAction |  | 
    
  
  
  
  
  
  call onClick methods on receivers or IInteractableHandlers
Declaration
  
    protected void SendOnClick(IMixedRealityPointer pointer)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | IMixedRealityPointer | pointer |  | 
    
  
  
  
  
  
  call OnVoinceCommand methods on receivers or IInteractableHandlers
Declaration
  
    protected void SendVoiceCommands(string command, int index, int length)
   
  Parameters
  
  
  
  
  
  Change the collision state
Declaration
  
    public virtual void SetCollision(bool collision)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Boolean | collision |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public virtual void SetCustom(bool custom)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Boolean | custom |  | 
    
  
  
  
  
  
  a public way to set the dimension index
Declaration
  
    public void SetDimensionIndex(int index)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Int32 | index |  | 
    
  
  
  
  
  
  Change the disabled state, will override the Enabled property
Declaration
  
    public virtual void SetDisabled(bool disabled)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Boolean | disabled |  | 
    
  
  
  
  
  
  Handle focus state changes
Declaration
  
    public virtual void SetFocus(bool focus)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Boolean | focus |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public virtual void SetGesture(bool gesture)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Boolean | gesture |  | 
    
  
  
  
  
  
  Change the gesture max state
Declaration
  
    public virtual void SetGestureMax(bool gesture)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Boolean | gesture |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public virtual void SetGrab(bool grab)
   
  Parameters
  
  
  
  
  
  Public method that can be used to set state of interactable
corresponding to an input going down (select button, menu button, touch)
Declaration
  
    public void SetInputDown()
   
  
  
  
  
  Public method that can be used to set state of interactable
corresponding to an input going up.
Declaration
  
  
  
  
  
  Change the Interactive state
Declaration
  
    public virtual void SetInteractive(bool interactive)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Boolean | interactive |  | 
    
  
  
  
  
  
  Change the observation state
Declaration
  
    public virtual void SetObservation(bool observation)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Boolean | observation |  | 
    
  
  
  
  
  
  Change the observation targeted state
Declaration
  
    public virtual void SetObservationTargeted(bool targeted)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Boolean | targeted |  | 
    
  
  
  
  
  
  Change the physical touch state
Declaration
  
    public virtual void SetPhysicalTouch(bool touch)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Boolean | touch |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public virtual void SetPress(bool press)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Boolean | press |  | 
    
  
  
  
  
  
  a public way to set state directly
Declaration
  
    public void SetState(InteractableStates.InteractableStateEnum state, bool value)
   
  Parameters
  
  
  
  
  
  Change the targeted state
Declaration
  
    public virtual void SetTargeted(bool targeted)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Boolean | targeted |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public virtual void SetToggled(bool toggled)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Boolean | toggled |  | 
    
  
  
  
  
  
  Creates the event receiver instances from the Events list
Declaration
  
    protected virtual void SetupEvents()
   
  
  
  
  
  
  
  Declaration
  
    protected virtual void SetupStates()
   
  
  
  
  
  Creates the list of theme instances based on all the theme settings
Declaration
  
    protected virtual void SetupThemes()
   
  
  
  
  
  
  
  Declaration
  
    public virtual void SetVisited(bool visited)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Boolean | visited |  | 
    
  
  
  
  
  
  Change the voice command state
Declaration
  
    public virtual void SetVoiceCommand(bool voice)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Boolean | voice |  | 
    
  
  
  
  
  
  Based on inputAction and state, should interactable listen to this up/down event.
Declaration
  
    protected virtual bool ShouldListenToUpDownEvent(InputEventData data)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | InputEventData | data |  | 
    
  
  Returns
  
  
  
  
  
  
  
  Declaration
  
    protected virtual void Start()
   
  
  
  
  
  Starts a timer to check if input is in progress
- Make sure global pointer events are not double firing
- Make sure Global Input events are not double firing
- Make sure pointer events are not duplicating an input event
Declaration
  
    protected void StartClickTimer(bool isFromInputDown = false)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Boolean | isFromInputDown |  | 
    
  
  
  
  
  
  sets some visual states for automating button events like clicks from a keyword
Declaration
  
    protected void StartGlobalVisual(bool voiceCommand = false)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Boolean | voiceCommand |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    protected void StopClickTimer()
   
  
  
  
  
  A public way to trigger or route an onClick event from an external source, like PressableButton
Declaration
  
    public void TriggerOnClick()
   
  
  
  
  
  Get a list of Mixed Reality Input Actions from the input actions profile.
Declaration
  
    public static bool TryGetInputActions(out string[] descriptionsArray)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String[] | descriptionsArray |  | 
    
  
  Returns
  
  
  
  
  
  Try to get a list of speech commands from the MRTK/Input/SpeechCommands profile
Declaration
  
    public static bool TryGetMixedRealitySpeechCommands(out SpeechCommands[] commands)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | SpeechCommands[] | commands |  | 
    
  
  Returns
  
  
  
  
  
  Look for speech commands in the MRTK Speech Command profile
Adds a blank value at index zero so the developer can turn the feature off.
Declaration
  
    public static bool TryGetSpeechKeywords(out string[] keywords)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String[] | keywords |  | 
    
  
  Returns
  
  
  
  
  
  
  
  Declaration
  
    protected virtual void Update()
   
  
  
  
  
  runs the state logic and sets state based on the current state values
Declaration
  
    protected virtual void UpdateState()
   
  Implements
  
      IMixedRealityFocusChangedHandler
  
  
      IMixedRealityFocusHandler
  
  
      IMixedRealityInputHandler
  
  
      IMixedRealitySpeechHandler
  
  
      IMixedRealityTouchHandler
  
  
      IMixedRealityInputHandler<>
  
  
      IMixedRealityInputHandler<>
  
  
      IMixedRealityInputHandler<>