Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Open XR how to prevent XRDirectInteractor from dropping current item?

Discussion in 'XR Interaction Toolkit and Input' started by pauliuso, Sep 3, 2021.

  1. pauliuso

    pauliuso

    Joined:
    Dec 11, 2014
    Posts:
    8
    Hello, I have an action based controller and direct interactor with default selected item. How can I prevent the interactor from dropping the item but still have a possibility to read the "Select Action" value?



     
  2. War_Tourist

    War_Tourist

    Joined:
    Dec 3, 2014
    Posts:
    8
    Best way I found was to disable the Select action when holding an item. Drag the action from the control scheme into the class in ed, then disable/enable as needed.

    Code (CSharp):
    1. using UnityEngine.InputSystem;
    2. public InputActionReference gripInputAction = null;
    3. gripInputAction.action.Disable();