[HOWTO] How To: Read Custom Fields From Dialogue Database

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Tony Li
Posts: 22871
Joined: Thu Jul 18, 2013 1:27 pm

[HOWTO] How To: Read Custom Fields From Dialogue Database

Post by Tony Li »

If you've defined custom fields in your dialogue database (or if you want to access built-in fields), here are two ways:

If the text fields are static, you can read them directly from the dialogue database using, for example, GetActor(). Example:

Code: Select all

var actor = DialogueManager.masterDatabase.GetActor("Charles");
string rank = actor.LookupValue("Rank");
Debug.Log("Charles is " + rank);
If the text field values can change at runtime, or if you simply prefer to use this method, use DialogueLua.GetActorField():

Code: Select all

string rank = DialogueLua.GetActorField("Charles", "Rank").asString;
Debug.Log("Charles is currently " + rank);
Post Reply