Excuse me if this has already come up before, but I can't seem to find anything about holding a conversation between the player, and multiple npc. In a conversation, I would like for the the two npc to talk to each other as well as the player. Is there a way to hold a conversation with more than 2 conversants? If not, what would be the best of way of going about doing this?
Thank you!
Multiple NPC Per Conversation
Re: Multiple NPC Per Conversation
Hi,
It just works. You don't have to do anything special. When you inspect a dialogue entry node, you can select the speaker using the the node's Actor dropdown. The Conversant dropdown specifies the person that the speaker is addressing, which may be used in sequencer commands such as LookAt(listener).
When you start a conversation, you can specify the runtime conversation's primary Actor and Conversant. This can be different from the actors defined in the conversation in the dialogue database. The example I always cite is a generic shopkeeper conversation. You can define a generic shopkeeper actor in the dialogue database and re-use this conversation for all shopkeeper NPCs in your game by specifying the NPC in the Conversation Trigger's Conversant field.
For additional actors beyond the primary Actor and Conversant, the conversation will look for a GameObject name that matches the actor's name -- or, if the GameObject has an Override Actor Name component, it will use the name specified in this component. This is mostly relevant if you use sequencer commands that reference those actors in sequencer commands such as LookAt(listener).
The other thing to think about is the dialogue UI. By default, most of the dialogue UIs use the same UI panel for all NPC subtitles. But it's quite possible to direct each NPC to its own panel. The Unity UI Dialogue UI makes this easiest. Inspect the Unity UI Dialogue UI component and tick Find Actor Overrides (near the bottom of the inspector). Then add an Override Unity UI Dialogue UI Controls component to the NPC and assign its UI elements. This is discussed a little more here in the context of world space UIs. You can also see it in action in the Examples/Unity UI Examples/World Space Dialogue UI example scene.
It just works. You don't have to do anything special. When you inspect a dialogue entry node, you can select the speaker using the the node's Actor dropdown. The Conversant dropdown specifies the person that the speaker is addressing, which may be used in sequencer commands such as LookAt(listener).
When you start a conversation, you can specify the runtime conversation's primary Actor and Conversant. This can be different from the actors defined in the conversation in the dialogue database. The example I always cite is a generic shopkeeper conversation. You can define a generic shopkeeper actor in the dialogue database and re-use this conversation for all shopkeeper NPCs in your game by specifying the NPC in the Conversation Trigger's Conversant field.
For additional actors beyond the primary Actor and Conversant, the conversation will look for a GameObject name that matches the actor's name -- or, if the GameObject has an Override Actor Name component, it will use the name specified in this component. This is mostly relevant if you use sequencer commands that reference those actors in sequencer commands such as LookAt(listener).
The other thing to think about is the dialogue UI. By default, most of the dialogue UIs use the same UI panel for all NPC subtitles. But it's quite possible to direct each NPC to its own panel. The Unity UI Dialogue UI makes this easiest. Inspect the Unity UI Dialogue UI component and tick Find Actor Overrides (near the bottom of the inspector). Then add an Override Unity UI Dialogue UI Controls component to the NPC and assign its UI elements. This is discussed a little more here in the context of world space UIs. You can also see it in action in the Examples/Unity UI Examples/World Space Dialogue UI example scene.