I've can't figure out how to map a button to the new Input System.
I've tickedt the "Use New Input" system and I wrote the name of the button in this field, but nothing happens.
What am I doing wrong here?
Cheers!

Code: Select all
using UnityEngine;
using UnityEngine.InputSystem;
public class MyInputActions : MonoBehaviour
{
void Awake()
{
controls = new MyControls(); // Use the name of the script the Input System has generated.
}
void OnEnable()
{
controls.Enable();
InputDeviceManager.RegisterInputAction("Back", controls.Player.Back);
InputDeviceManager.RegisterInputAction("ActionButton", controls.Player.ActionButton);
// (Note: Also assumes you've defined an action named Back for Input Device Manager.)
}
void OnDisable()
{
controls.Disable();
InputDeviceManager.UnregisterInputAction("Back");
InputDeviceManager.UnregisterInputAction("ActionButton");
}
}