Unity Timeline and Dialogue System Setup

Announcements, support questions, and discussion for the Dialogue System.
RetroVertigo
Posts: 55
Joined: Fri Apr 16, 2021 4:32 pm

Re: Unity Timeline and Dialogue System Setup

Post 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?
User avatar
Tony Li
Posts: 22159
Joined: Thu Jul 18, 2013 1:27 pm

Re: Unity Timeline and Dialogue System Setup

Post 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 497 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.)
RetroVertigo
Posts: 55
Joined: Fri Apr 16, 2021 4:32 pm

Re: Unity Timeline and Dialogue System Setup

Post 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
User avatar
Tony Li
Posts: 22159
Joined: Thu Jul 18, 2013 1:27 pm

Re: Unity Timeline and Dialogue System Setup

Post 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 492 times
Post Reply