Yarn2: Override actor's name?
Posted: Sun Nov 05, 2023 2:32 am
Hi, I'm using the dialogue system toghether with Yarn2 and wanna override actor's name on some lines.
When I was using Yarn2 alone, I added a tag as shown below, parsed the tag on the C# script, and temporarily overridden the actor's name.
In .yarn file:
In C#(It overrides Yarn's BaseClass):
Is it possible to do something like this with your system?
When I was using Yarn2 alone, I added a tag as shown below, parsed the tag on the C# script, and temporarily overridden the actor's name.
In .yarn file:
Code: Select all
Dude: I'm misterious guy. #display_as:???
Code: Select all
public class CharacterNameView : DialogueViewBase
{
[SerializeField]
private TextMeshProUGUI text = null!;
public override void RunLine(LocalizedLine dialogueLine, Action onDialogueLineFinished)
{
var displayAs = dialogueLine.GetTag("display_as");
if (displayAs != null)
{
text.text = displayAs;
}
else if (dialogueLine.CharacterName == null)
{
Hide();
}
else
{
Display(dialogueLine.CharacterName);
}
onDialogueLineFinished();
}
}