Have dialogue restart in specific scenarios

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 22163
Joined: Thu Jul 18, 2013 1:27 pm

Re: Have dialogue restart in specific scenarios

Post by Tony Li »

If the continue button has focus (i.e., in Unity UI terms, the EventSystem has selected it), then the EventSystem's Submit input will click it. By default, the Submit input is mapped to Return. This process is completely separate from UIButtonKeyTrigger, which listens for input and also issues a click without requiring the button to have focus.
soniclinkerman
Posts: 82
Joined: Wed Mar 31, 2021 6:48 pm

Re: Have dialogue restart in specific scenarios

Post by soniclinkerman »

I see, so how can I remove the focus on the "continue" button? It seems to be gone now because I unticked everything from trigger. That's why I thought the "Enter" key was no longer registering,
User avatar
Tony Li
Posts: 22163
Joined: Thu Jul 18, 2013 1:27 pm

Re: Have dialogue restart in specific scenarios

Post by Tony Li »

When you open your pause menu, set focus to one of your pause menu buttons. Example:

Code: Select all

public void OpenPauseMenu() // (just example code)
{
    pauseMenuWindow.SetActive(true);
    EventSystem.current.SetSelectedGameObject(somePauseMenuButton);
}
By setting PixelCrushers.UIPanel.monitorSelection = false; (as described in How To: Pause Dialogue In Pause Menu), the continue button won't try to steal focus back.
soniclinkerman
Posts: 82
Joined: Wed Mar 31, 2021 6:48 pm

Re: Have dialogue restart in specific scenarios

Post by soniclinkerman »

Awesome! Thanks a ton for the help!
User avatar
Tony Li
Posts: 22163
Joined: Thu Jul 18, 2013 1:27 pm

Re: Have dialogue restart in specific scenarios

Post by Tony Li »

Happy to help!
Post Reply