Page 1 of 1

Is it dangerous to have multiple fields with the same title

Posted: Fri Sep 01, 2023 2:06 pm
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.

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

Posted: Fri Sep 01, 2023 2:55 pm
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).