OnConversationLine getting hit twice when conversation starts

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
jlhacode
Posts: 77
Joined: Fri Jul 03, 2020 6:23 am

OnConversationLine getting hit twice when conversation starts

Post by jlhacode »

This is the stacktrace of the second OnConversationLine call

Screen Shot 2020-09-23 at 4.07.42 PM.png
Screen Shot 2020-09-23 at 4.07.42 PM.png (128.9 KiB) Viewed 683 times
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnConversationLine getting hit twice when conversation starts

Post by Tony Li »

That looks correct. What is the stack trace of the first call?

Does this also happen with DemoScene1 when you talk to the NPC?

As a test, you can add a Conversation Logger component to the Dialogue Manager. It will log every event: OnConversationStart, OnPrepareConversationLine, OnConversationLine, etc.
jlhacode
Posts: 77
Joined: Fri Jul 03, 2020 6:23 am

Re: OnConversationLine getting hit twice when conversation starts

Post by jlhacode »

Ran a test on DemoScene1, and can confirm that OnConversationLine() is getting hit twice. Here are the traces for the first & second hits respectively.

First:

Screen Shot 2020-09-23 at 7.47.51 PM.png
Screen Shot 2020-09-23 at 7.47.51 PM.png (176.41 KiB) Viewed 677 times



Second:

Screen Shot 2020-09-23 at 7.48.05 PM.png
Screen Shot 2020-09-23 at 7.48.05 PM.png (121.72 KiB) Viewed 677 times
Last edited by jlhacode on Wed Sep 23, 2020 10:54 pm, edited 1 time in total.
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnConversationLine getting hit twice when conversation starts

Post by Tony Li »

Are you sure it's the same line? Remember that OnConversationLine() will also be called for the <START> node, which typically has no text.

If you're sure that the first OnConversationLine is not for the <START> node, please click on each stack trace in the Console window, press Ctrl+C to copy it to the clipboard, and then paste it into a reply. This will give me the script line numbers so I can determine exactly where it's calling OnConversationLine.
jlhacode
Posts: 77
Joined: Fri Jul 03, 2020 6:23 am

Re: OnConversationLine getting hit twice when conversation starts

Post by jlhacode »

My mistake, it's definitely the start node causing that extra OnConversationLine. Thanks for the heads up!
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnConversationLine getting hit twice when conversation starts

Post by Tony Li »

Glad to help!
Post Reply