Hi there,
I use the variable "CurrentConversant" in some of my C# scripts.
However, when I change the conversant during a running dialogue, it doesn't seem to have an impact on the scripts. So I assume that CurrentConversant isn't updated while a dialogue is active.
Is there any way to change to change it manually?
Changing DialogueManager.CurrentConversant during dialogue
-
- Posts: 3
- Joined: Mon Nov 04, 2024 3:31 pm
Re: Changing DialogueManager.CurrentConversant during dialogue
Hi,
What's your intent? I may be able to provide a simpler solution.
What's your intent? I may be able to provide a simpler solution.
-
- Posts: 3
- Joined: Mon Nov 04, 2024 3:31 pm
Re: Changing DialogueManager.CurrentConversant during dialogue
I have multiple scripts, working like this:
Everything works fine so far. But if I change the conversant in the Dialogue System during a dialogue at some point (via inspector), the scripts don't seem to update.
Thank you for looking into this!
Code: Select all
private void Update()
{
var conversant = DialogueManager.CurrentConversant;
if (conversant != null)
{
something happens, depending on the CurrentConversant
}
}
Thank you for looking into this!
Re: Changing DialogueManager.CurrentConversant during dialogue
Hi,
Checking something every frame is called polling, which generally isn't a very efficient approach.
You may want to consider events instead. For example, if you want to know which GameObjects are the speaker and listener of each dialogue entry in an active conversation, you can add a script (or multiple scripts) with an OnConversationLine(Subtitle) method. Example:
Checking something every frame is called polling, which generally isn't a very efficient approach.
You may want to consider events instead. For example, if you want to know which GameObjects are the speaker and listener of each dialogue entry in an active conversation, you can add a script (or multiple scripts) with an OnConversationLine(Subtitle) method. Example:
Code: Select all
void OnConversationLine(Subtitle)
{
if (subtitle.speakerInfo.transform == this.transform)
{
// I'm the speaker, so do something special here.
// ...
}
}