Continue Button with New Input System
Posted: Wed May 12, 2021 4:44 pm
Hi Tony,
I have Unity's "new" input system working for the Dialogue System, but I ran into an oddity that I'm hoping you can help with. Normally when I click the continue button, it finishes typing out the dialogue and then I have to hit continue again to go to the next node (this is what I want), but when I use a gamepad and hit the button (which I've titled Action in this case) it types out the rest of the line and immediately goes to the next node (not what I want).
Any ideas? Not much to show, but here's the code and a screenshot of my PlayerActions setup.
PlayerActions: https://ibb.co/B2WZLjn
I have Unity's "new" input system working for the Dialogue System, but I ran into an oddity that I'm hoping you can help with. Normally when I click the continue button, it finishes typing out the dialogue and then I have to hit continue again to go to the next node (this is what I want), but when I use a gamepad and hit the button (which I've titled Action in this case) it types out the rest of the line and immediately goes to the next node (not what I want).
Any ideas? Not much to show, but here's the code and a screenshot of my PlayerActions setup.
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;
public PlayerActions controls;
void Awake()
{
controls = new PlayerActions();
}
void OnEnable()
{
if (!isRegistered)
{
isRegistered = true;
didIRegister = true;
controls.Enable();
InputDeviceManager.RegisterInputAction("Action", controls.PlayerControls.Action);
InputDeviceManager.RegisterInputAction("Movement", controls.PlayerControls.Movement);
}
}
void OnDisable()
{
if (didIRegister)
{
isRegistered = false;
didIRegister = false;
controls.Disable();
InputDeviceManager.UnregisterInputAction("Action");
InputDeviceManager.UnregisterInputAction("Movement");
}
}
}