Hi,
I am using UI Builder for my general UI with a button that triggers a conversation, where the player should make a choice.
When the dialogue is started the responses appear, but are not clickable. If I disable the UI Builders UI it works.
Can I set some sort of render order, or how do I fix this?
UI Builder: Responses not clickable
Re: UI Builder: Responses not clickable
Hi,
Make sure your scene still has an active EventSystem GameObject. You may need to tick the input module component's Force Module Active checkbox. Keep an inspector view on the EventSystem during play so you can see what the mouse is detecting.
If that doesn't help, what input system are you using? Unity's built-in input manager, Input System package, Rewired, or something else?
Alternatively, you can build your dialogue UI in UI Toolkit (UI Builder) and write a script that implements the IDialogueUI C# interface. You can find a starter script in Plugins / Pixel Crushers / Dialogue System / Templates / Scripts / TemplateDialogueUI.cs. Since UI Toolkit is getting more stable and closer to feature parity with Unity UI, I'll be working on an official UI Toolkit implementation of IDialogueUI in the near future.
Make sure your scene still has an active EventSystem GameObject. You may need to tick the input module component's Force Module Active checkbox. Keep an inspector view on the EventSystem during play so you can see what the mouse is detecting.
If that doesn't help, what input system are you using? Unity's built-in input manager, Input System package, Rewired, or something else?
Alternatively, you can build your dialogue UI in UI Toolkit (UI Builder) and write a script that implements the IDialogueUI C# interface. You can find a starter script in Plugins / Pixel Crushers / Dialogue System / Templates / Scripts / TemplateDialogueUI.cs. Since UI Toolkit is getting more stable and closer to feature parity with Unity UI, I'll be working on an official UI Toolkit implementation of IDialogueUI in the near future.
Re: UI Builder: Responses not clickable
I do have an active EventSystem Object in the Scene with a "Standalone Input Module", but there is no Checkbox "Force Module Active" and in the code it says this property is obsolete. I am using Unity 2022.3.10f1. I think I'm using the default built-in input manager. In the inspector view on the EventSystem the mouse is only detecting the response menu if the UI Toolkit UI is disabled.
It is working though when I set the Dialogue Manager canvas to Render Mode=Screen Space - Overlay instead of Camera. So for now this works, thanks for your help.
I am looking forward to your UI Toolkit implementation!
It is working though when I set the Dialogue Manager canvas to Render Mode=Screen Space - Overlay instead of Camera. So for now this works, thanks for your help.
I am looking forward to your UI Toolkit implementation!
Re: UI Builder: Responses not clickable
> t is working though when I set the Dialogue Manager canvas to Render Mode=Screen Space - Overlay instead of Camera.
When the Render Mode was set to Screen Space - Camera, did you assign a camera to the Canvas? Otherwise it won't pick up mouse input.
When the Render Mode was set to Screen Space - Camera, did you assign a camera to the Canvas? Otherwise it won't pick up mouse input.
Re: UI Builder: Responses not clickable
Yes, I assigned the same (and only) camera in the scene and even tried different sorting layers and orders. Didn't work.
Re: UI Builder: Responses not clickable
If you add another UI button to the Canvas that's outside of the dialogue UI, and if you can still click it (even if it does nothing), then this is probably a UI Toolkit issue, not a Dialogue System issue. You might want to bring it up on the UI Toolkit section of the Unity forum if that's the case.
Re: UI Builder: Responses not clickable
At runtime, UI Toolkit creates a child of the EventSystem GameObject named PanelSettings. This GameObject has a Panel Raycaster that intercepts mouse input, preventing Unity UI canvases from receiving mouse input.
One solution is to temporarily disable your UI Toolkit UIs' UI Document components. This will remove the PanelSettings GameObject until you re-enable the UI Documents.
Another option -- and probably the better option -- is to temporarily disable the Panel Raycaster during conversations. To do this, you can add this script to the Dialogue Manager:
DisablePanelRaycasterDuringConversations.cs
One solution is to temporarily disable your UI Toolkit UIs' UI Document components. This will remove the PanelSettings GameObject until you re-enable the UI Documents.
Another option -- and probably the better option -- is to temporarily disable the Panel Raycaster during conversations. To do this, you can add this script to the Dialogue Manager:
DisablePanelRaycasterDuringConversations.cs
Code: Select all
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UIElements;
public class DisablePanelRaycasterDuringConversations : MonoBehaviour
{
void OnConversationStart(Transform actor)
{
EventSystem.current.GetComponentInChildren<PanelRaycaster>().enabled = false;
}
void OnConversationEnd(Transform actor)
{
EventSystem.current.GetComponentInChildren<PanelRaycaster>().enabled = true;
}
}
Re: UI Builder: Responses not clickable
Thank you, your provided code is working fine!
Re: UI Builder: Responses not clickable
Glad to help!