How to configure Input for controlling dialogue selection using the New Input System
Posted: Tue Mar 09, 2021 5:58 pm
Hi,
I'm having trouble getting my head around how to use the New Input System to let the player control dialogue- i.e selecting dialogue options from a list. Initiating dialogue is fine, but I'm just totally lost once I get into the dialogue.
I've followed these steps:
Sorry if I'm being dense. I did spend a long time looking and reading on my own before deciding to post.
I'm having trouble getting my head around how to use the New Input System to let the player control dialogue- i.e selecting dialogue options from a list. Initiating dialogue is fine, but I'm just totally lost once I get into the dialogue.
I've followed these steps:
- Followed the Quick Start Guide in a new project
- Ticked New Input System in the Dialogue System Welcome page
- Told Unity to use the New Input System
- Created an InputActions asset, set it up
- Written code to register my new Inputs with the Input Device Manager, and added that as a component to my Input Manager
Code: Select all
protected static bool isRegistered = false; private bool didIRegister = false; private MasterInput controls; void Awake() { controls = new MasterInput(); } void OnEnable() { if (!isRegistered) { isRegistered = true; didIRegister = true; controls.Enable(); InputDeviceManager.RegisterInputAction("Submit", controls.Player.Interact); InputDeviceManager.RegisterInputAction("Cancel", controls.Player.Cancel); InputDeviceManager.RegisterInputAction("Movement", controls.Player.Movement); } } void OnDisable() { if (didIRegister) { isRegistered = false; didIRegister = false; controls.Disable(); InputDeviceManager.UnregisterInputAction("Submit"); InputDeviceManager.UnregisterInputAction("Cancel"); InputDeviceManager.UnregisterInputAction("Movement"); } }
Sorry if I'm being dense. I did spend a long time looking and reading on my own before deciding to post.