Page 2 of 2

Re: Unity Timeline and Dialogue System Setup

Posted: Wed Aug 04, 2021 11:31 am
by RetroVertigo
Tony
Thanks again for all your help. I think I got everything how I need but wanted to pick your brain if you had a minute to reply. Here is what I have so far:

Image

Which is pretty much what I wanted, but I wanted to know if there was a way to have the name in a different spot within the Text box. I am assuming I could do that with option 2 you mentioned, adding a separate text/TMPro element for portrait name and assigning that within the subtitle panel, but I am unsure on how to handle changing the name.
I want to rename my characters in the game so I believe I can update the actor name at runtime when the change is made by the player, but will that carry over if I do that with a new element? Is there a way to handle that, update player/actor name at runtime for a separate element assigned to subtitle panel?

Re: Unity Timeline and Dialogue System Setup

Posted: Wed Aug 04, 2021 1:32 pm
by Tony Li
Hi,

When you create an actor in the Dialogue Editor's Actors section, tick 'Use Display Name'. Then set the Display Name field.

At runtime, if an actor wants to change its name, change the Display Name value. For example, say you have an actor named Robert. To change his Display Name from "Robert" to "Bob" in C#:

Code: Select all

DialogueLua.SetActorField("Robert", "Display Name", "Bob");
To change it in the Script field of a conversation:
  • Dialogue Text: "Robert's too formal. Call me Bob."
  • Script: Actor["Robert"].Display_Name = "Bob"
Create a separate Text/TMPro element for the portrait name and assign it to the subtitle panel's Portrait Name field:

portraitName.png
portraitName.png (53.23 KiB) Viewed 503 times

At runtime, the subtitle panel will set the Portrait Name's text to the actor's current Display Name.

(Side note: Conversations cache the participants' Display Names at the start of the conversation. If you change a Display Name mid-conversation, it won't take effect until the next conversation -- unless you use the addon code in the "Discover Name Example" found on the Dialogue System Extras page.)

Re: Unity Timeline and Dialogue System Setup

Posted: Wed Aug 04, 2021 3:55 pm
by RetroVertigo
Again, my thanks, as this is coming together, and I apologize for all the questions, but I keep running into items as I tweak this. Right now, there is a Vertical Layout Group, which controls the position of the text, so is there anyway I can tweak where the text can be placed in the box, other than changing the Vert layout group? Basically, I want it just slightly to the right of the name, so I can lower the name down into the box more. Anyway to handle that, or do an indent to allow that? Looking at the Vert Layout or Text script you have, it seems there is no way to indent or tweak along those lines, but I wanted to ask.

Image

Re: Unity Timeline and Dialogue System Setup

Posted: Wed Aug 04, 2021 4:17 pm
by Tony Li
Hi,

You can create a Horizontal Layout Group inside the Vertical Layout Group, and set its Left padding to indent its children. Then move the Text GameObject to be a child of the Horizontal Layout Group:

nestedLayoutGroups.png
nestedLayoutGroups.png (80.77 KiB) Viewed 498 times