Hello,
Having a bit of an issue with cancelling dialogues.
It’s set to ESC and it seems to be actually working fine but only if the conversation is at a line by the Player. Press ESC and the dialogue closes as expected.
However doing the exact same thing while an NPC is talking nothing happens, the dialogue just jumps to the next line without closing the dialogue.
Is it the expected behavior or am I doing something wrong?
How should I set things up so by pressing ESC regardless of the actor the dialogue could closed?
Thank you.
Cancel dialogue anytime
Re: Cancel dialogue anytime
That's the default behavior.
- If the conversation is showing a subtitle (e.g,. NPC line), it listens for the Cancel Subtitle Input. If the player presses the Cancel Subtitle Input, it cancels the subtitle.
- If the conversation is showing a response menu, it listens for the Cancel Conversation Input. If the player pressed the Cancel Conversation Input, it cancels the entire conversation.
Code: Select all
using UnityEngine;
using PixelCrushers;
using PixelCrushers.DialogueSystem;
public class CancelConversationOnEsc : MonoBehaviour
{
void Update()
{
if (DialogueManager.isConversationActive && InputDeviceManager.IsKeyDown(KeyCode.Escape))
{
DialogueManager.StopAllConversations();
}
}
}
Re: Cancel dialogue anytime
worked nicely, thank you!