Skip to content

Setup Custom Input Bindings for SteamVR Input System

ChengNan Yang edited this page Nov 1, 2019 · 5 revisions
  • Step 1. Add new action set and actions in SteamVR Input window

    • After creating custom action set and actions, remember to Save and generate

      recommended_settings_apply_viu_action_set

  • Step 2. Bind custom action to controller

    • Click on Open Binding UI(Sometimes the page is blank) or go to SteamVR(top-left corner)>Devices>Controller Settings

    • Bind myaction to Trigger

      recommended_settings_apply_viu_action_set

  • Step 3. Create new action script

    • For SteamVR Plugin v2.0.1, this version is quite buggy
      • MUST add SteamVR_Behaviour.cs and SteamVR_ActivateActionSetOnLoad.cs
using UnityEngine;
using Valve.VR;

public class MyActionScript : MonoBehaviour
{
    public SteamVR_Action_Boolean myAction;
    public SteamVR_Input_Sources handType;

    void Update()
    {
        Debug.Log("Value GetState:" + myAction.GetState(handType));
        Debug.Log("Value GetStateUp:" + myAction.GetStateUp(handType));
        Debug.Log("Value GetStateDown:" + myAction.GetStateDown(handType));
    }
}
  • For SteamVR Plugin v2.1.0 and above
    • MUST add SteamVR_ActivateActionSetOnLoad.cs
Clone this wiki locally