AnimatorTrigger() - how does this know which animator to trigger?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

AnimatorTrigger() - how does this know which animator to trigger?

Post by fkkcloud »

Hi,

This is more of curiosity-
AnimatorTrigger() - how does this know which animator to trigger?

On DialogueSystemTrigger, I tried to put or remove Conversation Conversant. With or without this set to the gameobject with the animator - it still plays the animation.
I don't think I've set this specific animator for it.

How does this work?
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: AnimatorTrigger() - how does this know which animator to trigger?

Post by Tony Li »

Hi,

The answer has two parts:

1. The conversation uses these rules to know which GameObjects are the current actor and conversant:
Character GameObject Assignments

2. In sequencer commands, generally if you do not specify a GameObject name, it will use the GameObject associated with the node's current speaker. Also, if you don't know the GameObject name ahead of time, you can use the special keywords 'speaker' and 'listener', which refer to the GameObjects associated with the node's current speaker and listener.
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Re: AnimatorTrigger() - how does this know which animator to trigger?

Post by fkkcloud »

I am still confused about how it is working.

In "Actors" tab of the Dialogue window (that shows dialogue database I suppose), I do not set any gameobject/animator component.
The Actors tab now only has 2 items, Name/Description both of them are text that has nothing to do with the gameobject name or animator.

Then, I have Dialogue System Trigger that is attached to a parent gameobject of Conversant gameobject which has the animator component. I did not set anything to Dialogue System Trigger's Conversation Actor and Conversation Conversant. However, it still grabs the correct conversant to play/trigger the animation with "AnimatorTrigger(triggetName)" which is good but scary. :)

I just want to have a full control/understand how it is grabbing the "Animator" and the right GameObject without any hint..?
I will have more GameObjects with Animator in the future (perhaps group talks and stuff) so before I get into a deeper stage, I want to get the full picture in my head so I can apply different stuff with it.

edit: okay, I see that it was looking for an animator from children game objects of the Dialogue System Trigger if none is assigned. If I have 2 more conversant beside the main Conversation Actor and Conversation Conversant, how do I assign their gameObject or Animator?

Thank you!
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: AnimatorTrigger() - how does this know which animator to trigger?

Post by Tony Li »

Hi,

This page explains how GameObject are associated with actors: Character GameObject Assignments

If you use AnimatorTrigger() without specifying a GameObject name or 'speaker' or 'listener', it default to 'speaker', which is the GameObject associated with the current node's speaker. It will look for an Animator on this GameObject or its children.
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Re: AnimatorTrigger() - how does this know which animator to trigger?

Post by fkkcloud »

I missed the Dialogue Actor component <- this was what I was looking for!
Post Reply