Iterate over actors in C#?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Raelyr
Posts: 19
Joined: Sat Aug 12, 2017 11:47 am

Iterate over actors in C#?

Post by Raelyr »

Kind of a weird question, but is there a way to fetch the list of actors and their display names from the dialogue database to use in C#? For example, let's say there's a game feature where you can choose or set the display name (or 'nickname') of NPCs you encounter, and then take or collect 'notes' on them for later use - uh, like a phone book! The C# script managing the phone book may need to check all the nicknames you set via dialogue.
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

Re: Iterate over actors in C#?

Post by Tony Li »

Hi,

Sure:

Code: Select all

foreach (var actor in DialogueManager.masterDatabase.actors)
{
    Debug.Log(actor.Name + " aka " + DialogueLua.GetActorField(actor.Name, "Display Name").asString);
}
Raelyr
Posts: 19
Joined: Sat Aug 12, 2017 11:47 am

Re: Iterate over actors in C#?

Post by Raelyr »

Thanks Tony! I appreciate you.
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

Re: Iterate over actors in C#?

Post by Tony Li »

Happy to help!
Post Reply