Page 1 of 1
What are the consequences of having multiple DialogueActor with same Actor type in the scene?
Posted: Fri Nov 27, 2020 2:13 am
by fkkcloud
Hi,
What are the consequences of having multiple DialogueActor with same Actor type in the scene?
For example, if I have 2 separated objects - each has DialogueActor component on its top hierarchy. Actor type is same e.g John.
From the Conversation, if I set AnimatiorTrigger(Idle) while John is speaking, would both Animator get the trigger?
Following up question, if one of the gameObject is inactive, then would it prioritize the active one?
Re: What are the consequences of having multiple DialogueActor with same Actor type in the scene?
Posted: Fri Nov 27, 2020 8:33 am
by Tony Li
It is usually best if your scene only has one Dialogue Actor assigned to an actor.
The Dialogue System maintains an internal dictionary of Dialogue Actors. When a Dialogue Actor's OnEnable() method runs, it is assigned to the dictionary entry for the actor name, overwriting the dictionary entry if it was already set by another Dialogue Actor. When a conversation starts, it checks this dictionary to associate GameObjects with actors.
For example, say you have GameObjects named GO1 and GO2. Both of the have a Dialogue Actor component set to "John".
When GO1's Dialogue Actor runs OnEnable(), it sets the dictionary[John] = GO1.
When GO2's Dialogue Actor runs OnEnable(), it overwrites the dictionary[John] = GO2.
If only one GameObject is active at a time, that's fine. Whenever you activate a GameObject, its OnEnable() method runs.
Re: What are the consequences of having multiple DialogueActor with same Actor type in the scene?
Posted: Fri Nov 27, 2020 10:53 am
by fkkcloud
Tony Li wrote: ↑Fri Nov 27, 2020 8:33 am
When GO1's Dialogue Actor runs OnEnable(), it sets the dictionary[John] = GO1.
When GO2's Dialogue Actor runs OnEnable(), it overwrites the dictionary[John] = GO2.
For this case, if I make GO2 to be SetActive(false) later, then GO1 would have priority?
Re: What are the consequences of having multiple DialogueActor with same Actor type in the scene?
Posted: Fri Nov 27, 2020 10:56 am
by Tony Li
Only if you disable and re-enable GO1.