Search Unity

Question Action based input

Discussion in 'XR Interaction Toolkit and Input' started by tom_ptrs, Sep 7, 2021.

  1. tom_ptrs

    tom_ptrs

    Joined:
    Jun 26, 2017
    Posts:
    2
    Hi, I was checking out the action based input system. I tried to access the quest joystick or grip via code.
    In my c# script I add the following:
    public InputActionReference turnRef = null;
    (via the unity editor I drag the XRI LeftHand/Turn action to).
    In the start method of the script I subscribe myself to the event:
    void Start()
    {
    turnRef.action.started += Action_started1;
    }
    And I log if I have an event:
    private void Action_started1(InputAction.CallbackContext obj)
    {
    Debug.Log("test");
    }
    But I never got into the callback of the event. Any idea what I do wrong?
     
  2. NemesisWarlock

    NemesisWarlock

    Joined:
    Jan 21, 2017
    Posts:
    140
    This should help you out: