Page 1 of 1
How can I show player's name during the lines?
Posted: Tue Feb 11, 2020 7:33 am
by muramasa
Hey guys!
Could anyone tells me how can I show Player or Actor's name during the lines, please?
Re: How can I show player's name during the lines?
Posted: Tue Feb 11, 2020 9:58 am
by Tony Li
Hi! There are a few ways:
1. Use a Dialogue UI whose subtitle panels have Portrait Name fields. Example: In the Demo, when you talk to the NPCs, their name appears in the subtitle panel along with their dialogue text.
2. Or inspect the subtitle panel(s) and tick the Add Speaker Name checkbox. This will prepend the speaker's name to the front of the dialogue text.
3. Or, if you want to show the player's name in the dialogue text itself, use the [var=
variable] tag, such as:
- Dialogue Text: "Hello, [var=Actor]. How are you?"
If the player actor is not assigned as the conversation's Actor for any reason, you can use [lua(code)]. If you need to do this, let me know. It depends on how you've set up your actors. For example, if your actor is named "Player" and Use Display Name is ticked, you'd do this:
- Dialogue Text: "Hello, [lua(Actor["Player"].Display_Name)]. How are you?"
Note: If you don't see the player's lines at all, make sure you've ticked the Dialogue Manager's Subtitle Settings > Show PC Subtitles During Line.
Re: How can I show player's name during the lines?
Posted: Wed Feb 12, 2020 2:38 am
by muramasa
Awww! thanks for your help! point 3 is exactly what I need.
your system is the best dialog system of Unity!
Re: How can I show player's name during the lines?
Posted: Wed Feb 12, 2020 8:12 am
by Tony Li
Thanks! Glad to help!