NPC Panel Doesn't Hide Immediately

Announcements, support questions, and discussion for the Dialogue System.
airwick
Posts: 16
Joined: Fri Oct 28, 2016 12:43 pm

Re: NPC Panel Doesn't Hide Immediately

Post by airwick »

So I'm running into an issue where I have two NPC actor nodes connected one after the other and the dialogue text gets updated before the hide animation is finished. I use OnConversationLine to update the NPC panel color and that also gets called early. I'm looking in UIShowHideController to fix the issue and it seems to have a wait parameter but I'm not sure what it's waiting for since I comment out the invoke method and things still happen.

I made sure my NPC dialogue panel animation controller is set up like the example above. The animation controller has Show and Hide triggers and the states are also named Show and Hide since the UIShowHideController creates hash ids for the state names with the trigger names.

I was hoping for the NPC panel to play the hide animation completely, call OnConversationLine, then start the show animation for the next NPC. On a similar note, I was hoping on the same NPC with back to back dialogue nodes to just update their text instead of hiding the dialogue panel and replaying the show animation.

Any help would be appreciated. Thanks!
User avatar
Tony Li
Posts: 23260
Joined: Thu Jul 18, 2013 1:27 pm

Re: NPC Panel Doesn't Hide Immediately

Post by Tony Li »

Hi,

If you haven't already, import the latest patch from the Pixel Crushers customer download site. I'll PM you your access info right after sending this. It addresses some edge cases in UIShowHideController. That may fix the issue.

(BTW, the 'wait' parameter tells UIShowHideController to wait for the animation to finish before invoking the callback. However, if the subtitle panel starts the hide animation and then immediately needs to show the panel again, it will kill the hide animation and start playing the show animation.)

I'll double check the scenario you described with the TextMesh Pro Dialogue UI. If there are any gotchas, I'll let you know how to address them.
airwick
Posts: 16
Joined: Fri Oct 28, 2016 12:43 pm

Re: NPC Panel Doesn't Hide Immediately

Post by airwick »

Thanks for the response, I downloaded the patch and I’m still having the same issue.

After debuging some more I found calling TextMeshProDialogueUI:OnContinue sends a message to all the components from AbstractDialogueUI:OnContinue. The main components I’m looking at are UIShowHideController:Hide, MyCustomlistener:OnConversatonLine, and TextMeshProDialogueUI:ShowSubtitle.

UIShowHideController:Hide - Starts playing the hide animation
MyCustomlistener:OnConversatonLine - I update the NPC panel color and I’ll likely do a custom localization at this point (if type writer still works from here)
TextMeshProDialogueUI:ShowSubtitle - Turns on the appropriate objects for the subtitle and performs all the important things.

So I’ll need to somehow get this to flow better after pressing the continue button and I’m guessing I’ll need to overwrite the TextMeshProDialogueUI:OnContinue method and not call the base AbstractDialogueUI:OnContinue method. The main goal is for the same panel to wait for the hide animation to finish before calling show if it’s a different actor, if it’s the same actor I want the panel to stay up and just call the appropriate methods to type write the new text.

So for a different NPC actor the new order would be something like UIShowHideController:Hide (wait to hide) > MyCustomlistener:OnConversatonLine (update text, color) > TextMeshProDialogueUI:ShowSubtitle > UIShowHideController:Show.


Any direction getting this setup will be greatly appreciated.
User avatar
Tony Li
Posts: 23260
Joined: Thu Jul 18, 2013 1:27 pm

Re: NPC Panel Doesn't Hide Immediately

Post by Tony Li »

I'll put together an example scene and post it here later today. (I'm going to be out of the office for the next several hours.)

And, yes, if you change subtitle.formattedText.text in OnConversationLine, it will still work properly with the typewriter effect. Before the Dialogue System shows the text, it calls OnConversationLine to allow you to change the text, sequence, etc.
airwick
Posts: 16
Joined: Fri Oct 28, 2016 12:43 pm

Re: NPC Panel Doesn't Hide Immediately

Post by airwick »

Thank you! I'll keep an eye out for it!
User avatar
Tony Li
Posts: 23260
Joined: Thu Jul 18, 2013 1:27 pm

Re: NPC Panel Doesn't Hide Immediately

Post by Tony Li »

I added a checkbox (ticked by default) to TextMeshProDialogueUI that waits for the hide animation to finish, unless the next line is also spoken by the same actor. You can download the updated TextMesh Pro Support package here:

TextMeshPro_Support_2016-12-09.unitypackage

And an example scene here:

TMPro_Example_2016-12-09.unitypackage

(The scene is "TMPro Example 2".)

I believe it works the way you want, and it ended up being a nice addition to the dialogue UI script, so thank you. :-) If there are any issues, let me know and we can adjust the implementation to accommodate.

(Sorry about the Dropbox links; our web hosting provider is doing maintenance right now, and I didn't want to delay getting these to you.)
airwick
Posts: 16
Joined: Fri Oct 28, 2016 12:43 pm

Re: NPC Panel Doesn't Hide Immediately

Post by airwick »

Thank you so much. I attempted something on my end but the knowledge of what you've built shows with the subtlety of your changes.

One thing I did have to change in the "WaitForHideAndContinue" routine was a check for the previous actor id. The hide animation was not playing when it was different NPCs since it appears the spearkerInfo id was being checked against the destinationEntry id.

Before it was :

Code: Select all

state.subtitle.speakerInfo.id != state.FirstNPCResponse.destinationEntry.id
Changed To:

Code: Select all

state.subtitle.speakerInfo.id != state.FirstNPCResponse.destinationEntry.ActorID

The last issue I'm having is that the hide animation is not playing for the final NPC dialogue entry. In your "TMPro Example 2", the final NPC just turns off while mine just stays on screen. It looks like the issue is that my last NPC panel is not considered the "END" since at some point I created a new node and connected it to an earlier part of the conversation. This must mean that it's only considered the END if the last dialogue entry in the conversation has the highest ID. To get around this I just added an empty node, but maybe there's a way to specify a node the END node already?
User avatar
Tony Li
Posts: 23260
Joined: Thu Jul 18, 2013 1:27 pm

Re: NPC Panel Doesn't Hide Immediately

Post by Tony Li »

Sorry about that bug with destinationEntry.id vs. destinationEntry.ActorID. I just fixed that in the original version here.

I believe I fixed the END issue, too. The final node should be treated as "next speaker is different, so show hide animation" since "no further speakers" is different from the current speaker. Here's the updated package:

TextMeshPro_Support_2016-12-10.unitypackage
airwick
Posts: 16
Joined: Fri Oct 28, 2016 12:43 pm

Re: NPC Panel Doesn't Hide Immediately

Post by airwick »

Thank you so much for the support!

It's working great now.
airwick
Posts: 16
Joined: Fri Oct 28, 2016 12:43 pm

Re: NPC Panel Doesn't Hide Immediately

Post by airwick »

So I seem to be having issues with my response menu now and I can't seem to track down the issue. The error is in the ShowResponse method in AbstractDialogueUI.

"Dialogue System: In ShowResponses(): Object reference not set to an instance of an object"

Nothing seems to be null but I still get this error. The conversation is an NPC asking a player for a response. My response menu uses custom buttons and are not templates. Reverting the recent files you provided displays the response menu.
Post Reply