Page 1 of 1

Get A Variable From Actor

Posted: Tue Jul 08, 2025 2:51 pm
by Littlenorwegians
I have a setup with FMOD where when a letter appears in the dialogue, a short sound byte is played. Simple stuff to mimic speech. Here's the kicker,

I need some kind of system to basically detect the current speaker (The actor) and set an FMOD variable. Don't worry about the FMOD side of thing, that I can handle. I have ended up using the Text Animator

So, basically it's just kind of finding an EASY way to have a float variable (The pitch) associated with each invididual actor and have some way of another script to "get" that variable off the actor.

Re: Get A Variable From Actor

Posted: Tue Jul 08, 2025 3:33 pm
by Tony Li
Hi,

Add a script with an OnConversationLine(Subtitle) method to a GameObject in the Dialogue Manager's hierarchy. In it, you can check the speaker. Example:

Code: Select all

void OnConversationLine(Subtitle subtitle)
{
    Actor actor = DialogueManager.masterDatabase.GetActor(subtitle.speakerInfo.id);
    float fmodVariable = actor.LookupFloat("FMODVariable");
}

Re: Get A Variable From Actor

Posted: Wed Jul 09, 2025 1:58 pm
by Littlenorwegians
Perfect. That got exactly what I wanted.

Re: Get A Variable From Actor

Posted: Wed Jul 09, 2025 3:16 pm
by Tony Li
Great! Glad to help.