Hide UI during dialogue
Hide UI during dialogue
Is there anything within the Dialogue System that can disable UI elements during dialogues or do I need to script something myself? Parts of my UI (inventory ui) blocks parts of the dialogue box.
Re: Hide UI during dialogue
Hi,
Add a Dialogue System Events component to the Dialogue Manager. Configure the OnConversationStart() UnityEvent to hide your other UI elements. Configure OnConversationEnd() to show them again.
If you don't have a permanent reference to the UI elements that you can assign to those UnityEvents, you can write a script with OnConversationStart() and OnConversationEnd() methods such as:
Add a Dialogue System Events component to the Dialogue Manager. Configure the OnConversationStart() UnityEvent to hide your other UI elements. Configure OnConversationEnd() to show them again.
If you don't have a permanent reference to the UI elements that you can assign to those UnityEvents, you can write a script with OnConversationStart() and OnConversationEnd() methods such as:
Code: Select all
public class HideOtherUIsDuringConversations : MonoBehaviour
{
void OnConversationStart(Transform actor)
{ // (Example)
FindObjectOfType<InventoryUI>().Hide();
}
void OnConversationEnd(Transform actor)
{ // (Example)
FindObjectOfType<InventoryUI>().Show();
}
}
Re: Hide UI during dialogue
Tony Li wrote: ↑Tue Nov 03, 2020 8:14 am Hi,
Add a Dialogue System Events component to the Dialogue Manager. Configure the OnConversationStart() UnityEvent to hide your other UI elements. Configure OnConversationEnd() to show them again.
If you don't have a permanent reference to the UI elements that you can assign to those UnityEvents, you can write a script with OnConversationStart() and OnConversationEnd() methods such as:Code: Select all
public class HideOtherUIsDuringConversations : MonoBehaviour { void OnConversationStart(Transform actor) { // (Example) FindObjectOfType<InventoryUI>().Hide(); } void OnConversationEnd(Transform actor) { // (Example) FindObjectOfType<InventoryUI>().Show(); } }
Ahhhhh alright! Thank you!
Re: Hide UI during dialogue
Happy to help!
-
- Posts: 150
- Joined: Mon Nov 23, 2020 6:35 am
Re: Hide UI during dialogue
I think there's a step missing there. I've done that and the script does not receive those events and nothing gets executed.
Re: Hide UI during dialogue
Hi,
The OnConversationStart and OnConversationEnd methods are only called on the Dialogue Manager and the GameObjects associated with the conversation's primary participants. Make sure the script is on one of the participants. If you can't put it on one of the participants, hook into the equivalent C# events.
More info:
The OnConversationStart and OnConversationEnd methods are only called on the Dialogue Manager and the GameObjects associated with the conversation's primary participants. Make sure the script is on one of the participants. If you can't put it on one of the participants, hook into the equivalent C# events.
More info: