Сharacter change event
-
- Posts: 3
- Joined: Wed Nov 10, 2021 7:25 am
Сharacter change event
Is there an event in the system that is activated when changing the character?
Re: Сharacter change event
Hi,
What do you mean by changing the character? If you mean when a different character speaks a line, you could use an OnConversationLine method, Example:
What do you mean by changing the character? If you mean when a different character speaks a line, you could use an OnConversationLine method, Example:
Code: Select all
private int lastSpeakerID;
void OnConversationStart(Transform actor) { lastSpeakerID = -1; }
void OnConversationLine(Subtitle subtitle)
{
if (string.IsNullOrEmpty(subtitle.formattedText.text)) return;
if (subtitle.speakerInfo.id != lastSpeakerID)
{
Debug.Log($"{subtitle.speakerInfo.Name} started speaking.");
lastSpeakerID = subtitle.speakerInfo.id;
}
}