I'm trying to figure out if there's a way to override the way that the Dialogue System Controller checks if the cancel button has been pressed. I'm using Rewired for the input in my game and I would like to be able to connect it to the Dialogue System.
I've found that I can setup a regular KeyCode or a Button Name that references one of the buttons from the regular InputManager but I'm not using both since I'm setting those things up in the Rewired plugin.
So, is there a way to override this cancel button functionality?
Using custom input instead of basic Unity keycodes and InputManager
Re: Using custom input instead of basic Unity keycodes and InputManager
Hi,
Set the Dialogue Manager's Cancel keys to KeyCode.None and button names to a blank string. This disables the default input manager check.
An explicit delegate for third party input managers like Rewired is on the roadmap, but the following has worked well for other developers so the delegate hasn't been implemented yet.
Add a script to the Dialogue Manager that implements the OnConversationLine and OnConversationResponseMenu script messages. In them, send "OnCancelSubtitle" or "OnCancelResponseMenu". The script below uses the same cancel button for both types of cancel:
Set the Dialogue Manager's Cancel keys to KeyCode.None and button names to a blank string. This disables the default input manager check.
An explicit delegate for third party input managers like Rewired is on the roadmap, but the following has worked well for other developers so the delegate hasn't been implemented yet.
Add a script to the Dialogue Manager that implements the OnConversationLine and OnConversationResponseMenu script messages. In them, send "OnCancelSubtitle" or "OnCancelResponseMenu". The script below uses the same cancel button for both types of cancel:
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
using Rewired;
public class RewiredToDialogueSystem : MonoBehaviour {
public string cancelButton = "Cancel"; // Define this button in Rewired.
public int playerId = 0; // The Rewired player id.
private Player player;
private string cancelMessage = null;
void Awake() {
player = ReInput.players.GetPlayer(playerId);
}
void OnConversationLine(Subtitle subtitle) {
cancelMessage = "OnCancelSubtitle";
}
void OnConversationResponseMenu(Response[] responses) {
cancelMessage = "OnCancelResponseMenu";
}
void Update () {
if (DialogueManager.IsConversationActive && player.GetButtonDown(cancelButton)) {
SendMessage(cancelMessage);
}
}
}
Re: Using custom input instead of basic Unity keycodes and InputManager
Thanks a lot This is much easier then expected