Hi!
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!
Map to New Input system?
Re: Map to New Input system?
Hi,
One last step: Write a small script as described in the Input_Device_Manager.pdf manual (located in Plugins / Pixel Crushers / Common / Documentation), and add the script to your Dialogue Manager GameObject. For example, it might look like this:
The example script above tells the Dialogue System what inputs you've defined in the new Input System.
Also keep an eye on the Console window for any errors or warnings that might indicate other actions that need to be added to the script or removed from, say, the Dialogue Manager's Input Device Manager component. (I included an example of the standard "Back" button in the example script above.)
One last step: Write a small script as described in the Input_Device_Manager.pdf manual (located in Plugins / Pixel Crushers / Common / Documentation), and add the script to your Dialogue Manager GameObject. For example, it might look like this:
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");
}
}
Also keep an eye on the Console window for any errors or warnings that might indicate other actions that need to be added to the script or removed from, say, the Dialogue Manager's Input Device Manager component. (I included an example of the standard "Back" button in the example script above.)