Hi,
First check for any errors or warnings in the Console window. They may indicate a simple problem that you can address.
If not, settle in for a long wall of text since there are several possibilities.
The Dialogue System uses plain old Unity UI and its EventSystem. Your scene probably has an EventSystem in it; otherwise the Dialogue System will automatically create a default one at runtime since it's required for Unity UI interaction.
The EventSystem has an input module (usually called Standalone Input Module) that responds to pointer (mouse) activity and 4 inputs defined in Edit > Project Settings > Input. By default, those 4 inputs are Horizontal & Vertical (navigates buttons with keyboard or joystick), Submit ("clicks" buttons), and Cancel. Submit is usually mapped to the enter key and space bar. The EventSystem keeps track of which button is currently selected. It's also possible for no button to be currently selected. When you press the Submit input (e.g., space bar), the EventSystem will click the selected button. If a subtitle panel's continue button is selected, pressing the space bar will click it. Note: If you have added a UI Button Key Trigger to the continue button and set it to Space, then this will end up clicking the continue button
twice, which you don't want.
Also, if you have mapped "mouse button 0" to whatever input is set on the UI Button Key Trigger, then no matter where you click the UI Button Key Trigger will click the button. This may be what's happening with the button that's only clickable when the UI Button Key Trigger is enabled.
The Dialogue Manager's Canvas has a component called Graphic Raycaster that handles mouse input. Unless you've unticked the continue button's Raycast Target checkbox, the EventSystem will detect when the mouse is over the continue button. When you press the left mouse button, it will click the continue button. However, if another UI element (even a transparent one) is on top of the continue button, then it will block the Graphic Raycaster. To check this, you can keep the Inspector view on the EventSystem while playing in the editor. The details at the bottom of the Inspector view will report what UI element the pointer is over.
In addition, the Dialogue Manager's Input Device Manager component has several options that can change the EventSystem's behavior:
- Input Device: If set to Joystick or Touch, it hides the mouse cursor. If you move the mouse, it automatically switches the dropdown to Mouse.
- Always Auto Focus: If ticked, ensures that the EventSystem always keeps an appropriate button selected. If the conversation is showing a subtitle, it keeps the continue button selected so you can press the Submit input (e.g., space bar) to click it.
- Detect Mouse Control: If unticked, it will not automatically switch the Input Device dropdown to Mouse.
- Control Graphic Raycasters: Generally keep this unticked. If ticked, then when the Input Device is set to Joystick or Touch it will disable all Canvas's Graphic Raycaster components, preventing mouse input.
To summarize, check this:
- Keep an Inspector view on the EventSystem. Are any UI elements blocking the continue button?
- Is the Graphic Raycaster working, and is Raycast Target ticked on the continue button?
BTW, to click anywhere on the screen, the usual approach is to resize the continue button so it covers the entire screen, and make it use an invisible image. This way, no matter where the player clicks it will hit the continue button unless another UI element is on top of it.
Hulda_Gnodima wrote: ↑Sat Jan 18, 2020 6:01 am2. Fast forwarding not working on NPC
Check how the Standard UI Continue Button Fast Forward components are set up on the PC and NPC panels. Make sure the continue button's OnClick() event is configured to call StandardUIContinueButtonFastForward.OnFastForward, and that the Typewriter Effect field is assigned.
Hulda_Gnodima wrote: ↑Sat Jan 18, 2020 6:01 am3. Any key-press to advance convo?
It's not built in, but you could add a script like this to the continue button:
Code: Select all
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class ClickOnAnyKey : MonoBehaviour
{
void Update()
{
if (Input.anyKeyDown) // A key was pressed.
{
// Make sure the key wouldn't also click the button if the key is Submit and the button is currently selected:
var isCurrentlySelected = EventSystem.current.currentSelectedGameObject == this.gameObject;
if (!(isCurrentlySelected && Input.GetButtonDown("Submit"))
{
// Simulate a button click:
GetComponent<Button>().onClick.Invoke();
}
}
}
}
(I just typed the script into this reply; pardon any typos.)
Use a Proximity Selector instead.
When the Selector is set to Center of Screen, it runs a raycast through a single point in the exact center of the screen. It looks like sometimes the raycast happens to be just outside the NPC's collider.
Instead, try these steps on the player:
- Remove the Selector.
- Add a collider if the player doesn't already have one. (You can do these steps on a child GameObject if you prefer.)
- Add a Rigidbody2D is the player doesn't already have one. Change Body Type to Kinematic.
- Add a Proximity Selector. If you've put these components on a child GameObject, assign the main player GameObject to the Actor Transform field. Set the Use Key and/or Use Button to the input you want to use.
Now when the player's collider intersects with the NPC's trigger collider, the Proximity Selector will detect it, show the use message, and allow interaction when you press the Use Key or Use Button.
If you get stuck on any of this, please feel free to send a reproduction project to tony (at) pixelcrushers.com along with steps to reproduce the issues. If you pack up a reproduction project, you only need to zip up the Assets, ProjectSettings, and Packages folders. You can omit the other files and folders.