Check if Response Menu is active through code
-
- Posts: 83
- Joined: Wed Jun 24, 2020 5:06 pm
Check if Response Menu is active through code
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
Hi! The response menu panel's StandardUIMenuPanel component has OnOpen() and OnClose() UnityEvents. Can you use those?
-
- Posts: 83
- Joined: Wed Jun 24, 2020 5:06 pm
Re: Check if Response Menu is active through code
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.
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
Hi,
Make sure you're checking the correct dialogue UI. This should work:
Make sure you're checking the correct dialogue UI. This should work:
Code: Select all
bool isMenuActive = DialogueManager.standardDialogueUI.conversationUIElements.defaultMenuPanel.isOpen;
-
- Posts: 83
- Joined: Wed Jun 24, 2020 5:06 pm
Re: Check if Response Menu is active through code
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
You could use an OnConversationResponseMenu(Response[]) method instead of OnConversationLine.