Some questions about changing actor name in c# scripts once?
Posted: Tue May 03, 2022 10:41 am
Hi,I'm not native English speaker so my content may has some English error.
I'm new to dialogue system, and I want to create a public speaker actor so I could set different actor attribute to the public one when I come to different conversation node. And I have some problems.
Here is my code
First, could I set displayname in c#? I only find Name attribute to set, so I choose to set Name, and it dose work.
Second, I call this event twice in on conversation, in first called place, it worked. This public actor name change to the name I need.
But in second place, this actor name remain the last name. And in visual studio debug mode, I confirm the publicSpeaker.Name has changed to my second name. So I don't know what happened.
I don't know how to realize it or is impossible in dialogue system?
Please tell me more,. thanks!!!!
I'm new to dialogue system, and I want to create a public speaker actor so I could set different actor attribute to the public one when I come to different conversation node. And I have some problems.
Here is my code
Code: Select all
public void SetThoughtToPublicSpeaker(string thoughtName)
{
//I use variables to record different actor name
string thoughtValue = DialogueLua.GetVariable(thoughtName).asString;
Actor publicSpeaker = DialogueManager.masterDatabase.GetActor(publicSpeakerName);
if (publicSpeaker != null)
{
Debug.Log("get speaker and thought");
publicSpeaker.Name = thoughtValue;
}
else
{
Debug.LogWarning("actor not setting");
}
}
Second, I call this event twice in on conversation, in first called place, it worked. This public actor name change to the name I need.
But in second place, this actor name remain the last name. And in visual studio debug mode, I confirm the publicSpeaker.Name has changed to my second name. So I don't know what happened.
I don't know how to realize it or is impossible in dialogue system?
Please tell me more,. thanks!!!!