Is it dangerous to have multiple fields with the same title

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
lgarczyn
Posts: 30
Joined: Fri May 05, 2023 5:28 am

Is it dangerous to have multiple fields with the same title

Post by lgarczyn »

I want to add a basic "array" of strings to actors, and I'm not too fond of parsing a JSON string every time I want to access it, nor do I want to spend too long writing editor code.

I thought about simply having fields with the same name, and a helper function to gather them in an array when needed.

Like this:
Image
Image

Short question, would that break anything? The dialogue editor doesn't seem to mind.
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Is it dangerous to have multiple fields with the same title

Post by Tony Li »

That's fine. Make sure to get the field values from your dialogue database, such as:

Code: Select all

List<Field> portraitFields = DialogueManager.masterDatabase.GetActor("Player").fields.Find(x => x.title == "Portrait");
and not from Lua:

Code: Select all

string value = DialogueLua.GetActorField("Player", "Portrait").asString;
since Lua will only have one of the values (the last one in the All Fields list).
Post Reply