Page 1 of 1

Receive dialogue data when each conversation node start

Posted: Mon Jul 10, 2023 7:44 am
by Luphan
Hi, We are now working on a quite complex animation system and would like to attach data on each conversation node that when each node trigger, I can receive an information data set from dialogue system which contains actor, emotion id, animation id, etc... Most important of all, we want our artist to edit it. so we might like to modify that data easly from the inspector of the node

I know that there are sequence and script utility which is very flexable to use, but it also has the disadvantage as string. If something type wrong or maybe having need to rename method, variable name. It will be difficult to track all the conversation node that use it the keyword.

so we are wondering if there's a way for as to add one more serialized data at the buttom of the conversation node's inspector? or is there any other way that you suggest?

Re: Receive dialogue data when each conversation node start

Posted: Mon Jul 10, 2023 9:25 am
by Tony Li
Hi,

Yes, you can do this. Add fields to the dialogue entry template (see Templates), and tick the Main checkbox:

customFields.png
customFields.png (47.71 KiB) Viewed 273 times

They will appear in the Inspector like this:

customFieldsInspector.png
customFieldsInspector.png (35.4 KiB) Viewed 273 times

In the screenshots above, the field type is Text. You may want to change this to a dropdown menu (e.g., Emotion ID = Happy, Sad, Angry, etc.). To do that, define a Custom Field Type.

Then add a script with an OnConversationLine method to the Dialogue Manager GameObject. In this method, access the fields:

Code: Select all

void OnConversationLine(Subtitle subtitle)
{
    string emotionID = Field.LookupValue(subtitle.dialogueEntry.fields, "Emotion ID");
    // Do something with emotionID.
}

Re: Receive dialogue data when each conversation node start

Posted: Mon Jul 17, 2023 7:51 am
by Luphan
Thank you! Tony!

You really explain it clearly and make it so easy to understand!

Re: Receive dialogue data when each conversation node start

Posted: Mon Jul 17, 2023 10:09 am
by Tony Li
Glad to help!