Unity Events on Dialogue Entry

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
hannah
Posts: 17
Joined: Mon Feb 22, 2016 10:42 pm

Unity Events on Dialogue Entry

Post by hannah »

Would it be possible to get some UnityEvents on the dialogue entries? It would be really powerful. Alternatively, could you point me in the correct direction to implement this myself if not? It would be a really valuable feature for us.
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Unity Events on Dialogue Entry

Post by Tony Li »

Hi Hannah,

The Dialogue System Events component has two dialogue entry-specific events: On Conversation Line and On Conversation Line Cancelled.

You can also receive these events from script messages, as well as an additional OnPrepareConversationLine that's invoked before a dialogue entry is displayed (versus OnConversationLine which is invoked right after).

If these don't cover your needs, what additional events would be helpful?
hannah
Posts: 17
Joined: Mon Feb 22, 2016 10:42 pm

Re: Unity Events on Dialogue Entry

Post by hannah »

Sorry for the late reply, I got caught up and forgot that I posted this. I'd like events directly on the dialogue entry if possible.
ss (2016-07-25 at 06.38.27).png
ss (2016-07-25 at 06.38.27).png (19.91 KiB) Viewed 2732 times
This would allow my design to do a lot more game logic scripting.
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Unity Events on Dialogue Entry

Post by Tony Li »

Got it, thanks. I just added it. It'll be in a patch release coming out tomorrow.
hannah
Posts: 17
Joined: Mon Feb 22, 2016 10:42 pm

Re: Unity Events on Dialogue Entry

Post by hannah »

Amazing, you're the best!
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Unity Events on Dialogue Entry

Post by Tony Li »

Version 1.6.6 is now available on the customer download site! :-)

This includes an "OnExecute" UnityEvent for each dialogue entry. However, there are a couple restrictions as documented in: Note About UnityEvents in Dialogue Entries

I'll also paste them below:

If you expand the Event foldout, you can add event handlers to a UnityEvent called OnExecute(), similar to adding an event handler to a Unity UI Button's OnClick() event. However, since the dialogue database exists independent of whatever scene is open, you can't assign a scene object to the event handler. Instead, you must assign an asset file such as a ScriptableObject.

To assign custom code to the OnExecute() event, put your custom code inside a ScriptableObject class and create an asset file using that class. For more information on creating ScriptableObject assets, see Unity's tutorial: https://unity3d.com/learn/tutorials/mod ... le-objects

UnityEvents also aren't converted by the Database > Export feature or Dialogue Database Converters since they can't be translated into non-Unity text formats.
Roncin
Posts: 11
Joined: Sun Aug 17, 2014 10:17 pm

Re: Unity Events on Dialogue Entry

Post by Roncin »

Hi Toni

This feature looks REALLY valuable to me but I was caught by not being able to export the database.

Some database features that would be really useful, even if I had to use a second file or non chat mapper compatible file...
1) Export the node layout. (Reimporting nodes as a new database causes everything to be rerouted)
2) This event trigger
3) A field for developer notes on the dialogue

Tip:
Spellcheck the csv files using Notepad++
I've had a lot of spelling errors in my dialogue. Excel was horrible for spell checking these because of the embedded codes for scripts, lua and formatting. However Notepad++ (v6.5.3) recognized the code syntax "\nOne" as being a carriage return followed by the word One. Microsoft excel, not so much. However, some forum notes indicated that the most recent releases of Notepad++ had the dictionary removed.
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Unity Events on Dialogue Entry

Post by Tony Li »

Hi Andrew,
Roncin wrote:Some database features that would be really useful, even if I had to use a second file or non chat mapper compatible file...
1) Export the node layout. (Reimporting nodes as a new database causes everything to be rerouted)
Will do. If this doesn't make it into 1.6.6.2 (which will primarily address some Unity 5.4 API changes), it should be in the next version.
Roncin wrote:2) This event trigger
I'll see what I can do. I may be able to record asset GUIDs and re-link them.
Roncin wrote: 3) A field for developer notes on the dialogue
Conversations and dialogue entries both have a Description field. Would this suffice?
Roncin wrote:Tip:
Spellcheck the csv files using Notepad++
I've had a lot of spelling errors in my dialogue. Excel was horrible for spell checking these because of the embedded codes for scripts, lua and formatting. However Notepad++ (v6.5.3) recognized the code syntax "\nOne" as being a carriage return followed by the word One. Microsoft excel, not so much. However, some forum notes indicated that the most recent releases of Notepad++ had the dictionary removed.
Good tip. If you're using the latest Notepad++, you can still download DSpellCheck from the repo and drop the DLL into the Plugins folder to get spellcheck back.
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Unity Events on Dialogue Entry

Post by Tony Li »

In version 1.6.6.2's documentation, I added a complete example (with code and screenshots) of using dialogue entry UnityEvents. You can view it here:

Recipe: Dialogue Entry UnityEvents
Post Reply