Check if Response Menu is active through code

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
gblekkenhorst
Posts: 83
Joined: Wed Jun 24, 2020 5:06 pm

Check if Response Menu is active through code

Post by gblekkenhorst »

Is there a way to check whether the current dialogue panel showing is the response menu? I want an animation to trigger when it opens and another to trigger when it closes. Thanks!
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Check if Response Menu is active through code

Post by Tony Li »

Hi! The response menu panel's StandardUIMenuPanel component has OnOpen() and OnClose() UnityEvents. Can you use those?
gblekkenhorst
Posts: 83
Joined: Wed Jun 24, 2020 5:06 pm

Re: Check if Response Menu is active through code

Post by gblekkenhorst »

Not quite what I'm looking for, I don't need to call them, I just want to check if they're already happening in the conversation. I have a script that runs different animations, and one of the animations I want to run is when the conversation hits a response node.

I wrote something checking the Response Panel StandardUIMenuPanel, I tried checking both isActiveAndEnabled and isOpen but neither seem to trigger.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Check if Response Menu is active through code

Post by Tony Li »

Hi,

Make sure you're checking the correct dialogue UI. This should work:

Code: Select all

bool isMenuActive = DialogueManager.standardDialogueUI.conversationUIElements.defaultMenuPanel.isOpen;
gblekkenhorst
Posts: 83
Joined: Wed Jun 24, 2020 5:06 pm

Re: Check if Response Menu is active through code

Post by gblekkenhorst »

Thank you, i'd missed the response panel is default! An issue I discovered is that I was trying to check that variable in OnConversationLine(Subtitle subtitle), it didn't work until I checked it in an update loop. It must become true after that function is called. I've got it checking in the Update loop working for now, but is there a better DS function to use than OnConversationLine?
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Check if Response Menu is active through code

Post by Tony Li »

You could use an OnConversationResponseMenu(Response[]) method instead of OnConversationLine.
Post Reply