Page 1 of 1
Check if Response Menu is active through code
Posted: Thu Aug 22, 2024 7:14 pm
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!
Re: Check if Response Menu is active through code
Posted: Thu Aug 22, 2024 9:08 pm
by Tony Li
Hi! The response menu panel's StandardUIMenuPanel component has OnOpen() and OnClose() UnityEvents. Can you use those?
Re: Check if Response Menu is active through code
Posted: Fri Aug 23, 2024 12:31 pm
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.
Re: Check if Response Menu is active through code
Posted: Fri Aug 23, 2024 3:14 pm
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;
Re: Check if Response Menu is active through code
Posted: Fri Aug 23, 2024 3:50 pm
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?
Re: Check if Response Menu is active through code
Posted: Fri Aug 23, 2024 7:16 pm
by Tony Li
You could use an
OnConversationResponseMenu(Response[]) method instead of OnConversationLine.