InputActionHandler script in MRTK throwing IndexOutOfRangeException when setting Input Action

Juan 1 Reputation point

I am trying to develop a HoloLens 2 app using MRTK in Unity. My goal is to execute a function when holding/air tapping, so I have followed this tutorial. I have added a new Input Action, marked it as "Digital", and linked it to the Hold gesture Action under the Gestures drop down. However, when I try to assign it to the InputActionHandler script (which is in my camera object), it throws the following error whenever I select my custom Action from the drop down:

IndexOutOfRangeException: Index was outside the bounds of the array.  
Microsoft.MixedReality.Toolkit.Input.Editor.InputActionPropertyDrawer.OnGUI (UnityEngine.Rect rect, UnityEditor.SerializedProperty property, UnityEngine.GUIContent content)  

Selecting other default actions doesn't give this error, and since I can see my Action in the dropdown, I'm assuming it may be a bug.

Any help is appreciated, thank you.

HoloLens Development
HoloLens Development
HoloLens: A family of Microsoft self-contained, holographic devices that enable engagement with digital content and interaction with holograms in the surrounding environment.Development: The process of researching, productizing, and refining new or existing technologies.
390 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Seth DU - MSFT 541 Reputation points

    Hello, welcome to Microsoft Q&A,

    I can reproduce the issue you have described above. According to my test experience, it can be caused by corrupted MRTK configuration files.

    To solve this issue, simply delete the Fire Raycast and add a new Action then reimport the assets. To reproduce and test this issue I have done the following steps then the issue is solved.

    1. Add a new Action. Close and re-open the project. Fire Raycast now can be selected in Input Action Handler, but my customized action is unable to select, there is no error in the console.
    2. Delete both actions then add Fire Raycast again. Reimport the assets and refresh the project.
    3. Input Action Handle and Fire Raycast work fine now.


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.