Hi!
I have an interaction UI that pops up when near to anything with my Interactable script. I'm having trouble making the interact UI only show near NPCs if they have valid entries in their dialogue conversation, and to not show up even if in range if there aren't any entries that can be shown. The conversations are started from a Dialogue System Trigger that each NPC has, so there could be an easy way to reference each NPC's own conversation from there.
Ideally I would prefer doing this in script, because my dialogue entries already have a lot of quest state conditions to keep track of in the Conversation Editor. Thanks in advance!
Only showing interact UI if NPC has something to say
Re: Only showing interact UI if NPC has something to say
Hi,
Show your Interact UI only if the conversation currently has a valid entry. You can check DialogueManager.ConversationHasValidEntry(), like the example below:
Show your Interact UI only if the conversation currently has a valid entry. You can check DialogueManager.ConversationHasValidEntry(), like the example below:
Code: Select all
var dsTrigger = npc.GetComponent<DialogueSystemTrigger>();
bool hasValidEntry = DialogueManager.ConversationHasValidEntry(dsTrigger.conversation);
if (hasValidEntry) ShowInteractionUI();
Re: Only showing interact UI if NPC has something to say
Thank you for the quick reply, it worked perfectly!
Re: Only showing interact UI if NPC has something to say
Glad to help!