Page 1 of 1

How to Change ActorName at runtime

Posted: Tue May 27, 2025 4:16 am
by Monsta
Hi Tony,

I'm so happy about the DS updates! I'm always amazed by the convenient features :)
Anyway, I'm currently using DS with the EasySave3.
During on conversation, I've made it so that if the player clicks on an 'Info' UI button, change variables like their name and age at any time. I've linked the name like this in my C#Script:

Code: Select all

public void SaveName()
{
	string newSaveName = userName.text;
	DataManager.instance.ppDatas.playerName = newSaveName;
	DialogueManager.ChangeActorName("Player", newSaveName); 
}
like this, but the character name of the text panel changed right away during runtime,
but [var=Actor] Tag used in the Dialogue Text didn't change. so:

Code: Select all

DialogueLua.SetVariable("PlayerName", newSaveName);
I added this code and did [var=PlayerName], and it changed right away.

a better method for the [var=Actor] tag to reflect the changed name immediately?
(Of course, it does change if I restart the conversation or scene,,,, but...)

Re: How to Change ActorName at runtime

Posted: Tue May 27, 2025 8:58 am
by Tony Li
Hi,

Use this patch:

DS_ChangeActorName_2025-05-27.unitypackage

Or add one line to your method:

Code: Select all

public void SaveName()
{
    string newSaveName = userName.text;
    DataManager.instance.ppDatas.playerName = newSaveName;
    DialogueManager.ChangeActorName("Player", newSaveName);
    DialogueLua.SetVariable("Actor", newSaveName);
}
The patch is more complete because it also handles [var=Conversant] if applicable.

Re: How to Change ActorName at runtime

Posted: Tue May 27, 2025 8:19 pm
by Monsta
It works perfectly at runtime! Thanks, Tony!

Re: How to Change ActorName at runtime

Posted: Tue May 27, 2025 8:25 pm
by Tony Li
Glad to help!