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!!!!