1. From the Package Manager window, import the new Input System.
2. On the Dialogue System's Welcome Window (Tools > Pixel Crushers > Dialogue System > Welcome Window), tick the USE_NEW_INPUT checkbox:
3. Write an optional script to tell the Input Device Manager about any inputs that you may have defined in your new Input System actions asset. Make sure you've ticked the actions assets' option to generate a C# script file. The example script below assumes your actions asset has generated a C# script file named MyControls.cs.
The example script below is named RegisterMyControls. It registers two inputs -- "Back" and "Interact" -- so the Dialogue System knows about them:
RegisterMyControls.cs
Code: Select all
using UnityEngine;
using UnityEngine.InputSystem;
using PixelCrushers;
public class RegisterMyControls : MonoBehaviour // Add me to Dialogue Manager.
{
protected static bool isRegistered = false;
private bool didIRegister = false;
void Awake()
{
controls = new MyControls();
}
void OnEnable()
{
if (!isRegistered)
{
isRegistered = true;
didIRegister = true;
controls.Enable();
InputDeviceManager.RegisterInputAction("Back", controls.Gameplay.Back);
InputDeviceManager.RegisterInputAction("Interact", controls.Gameplay.Interact);
}
}
void OnDisable()
{
if (didIRegister)
{
isRegistered = false;
didIRegister = false;
controls.Disable();
InputDeviceManager.UnregisterInputAction("Back");
InputDeviceManager.UnregisterInputAction("Interact");
}
}
}
4. If you're using a Selector or Proximity Selector, set its Use Button to one of the inputs that you've registered, such as "Interact" (without quotes) in the example above. Alternatively, if you've set the Use Key, the Input Device Manager will do its best to translate the key code into a corresponding key definition in the new Input System. This generally works for all standard keyboard keys such as F or Esc.