Get list of Axes?

Is there a way to get the list of axes, or enumerate them somehow, defined in the InputManager? I know I can get them if I know there name. I want to get all the defined ones, to find their names and such.


Edit: As pointed out by Bunny in the comments - this will only work in the editor and relies on reflection - it could easily break in future versions of Unity if they randomly decide to rename or restructure their input classes/data. However there is no real alternative with the existing (as of 2017.1) input system.

using UnityEngine;
using System.Collections;

using UnityEditor;

public class ReadInputManager
    public static void ReadAxes()
        var inputManager = AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/InputManager.asset")[0];

        SerializedObject obj = new SerializedObject(inputManager);

        SerializedProperty axisArray = obj.FindProperty("m_Axes");

        if (axisArray.arraySize == 0)
            Debug.Log("No Axes");

        for( int i = 0; i < axisArray.arraySize; ++i )
            var axis = axisArray.GetArrayElementAtIndex(i);

            var name = axis.FindPropertyRelative("m_Name").stringValue;
            var axisVal = axis.FindPropertyRelative("axis").intValue;
            var inputType = (InputType)axis.FindPropertyRelative("type").intValue;


    public enum InputType

    public static void DoRead()


If you have a look at the Input Manager the rest should be pretty easy to figure out.

Hi, I’m strugling with same issue here. It would be really handy to be able to get that list from a script.

Nope, there’s no way to do it. Unity’s InputManager is extremely limited and doesn’t allow you do to anything at all during runtime except get input.

Update: Yes, it’s possible in the editor as Sarkhan’s post shows, but not in a game build.

I’m not sure exactly how but I think that you need to use GetComponent and for loops :slight_smile:

these two videos might help