Reply To: Multiple Npc Talking

Home Forums Books Mastering Unity 2D Game Development Multiple Npc Talking Reply To: Multiple Npc Talking


OK, finally got round to posting the example code (apologies it took so long)

Updated Messaging manager, adding a new event subscriber for the new conversation.  (Granted this is bulky at present, will do a new version with the new UI eventsystem)

New Broadcast receiver for the new conversation, for adding to the new character.  Don’t forget to also add a ConversationComponent and a new conversation asset!

(Granted, this could be refactored to be more generic given the only difference is the list is subscribed to)

Finally, the Broadcast script to alert when the conversation should start, should be attached to the collider trigger to begin the conversation.

As a bonus, I also updated the conversation manager script to set the completed flag on the conversation so it only plays once.


At present it only plays one conversation at a time and if a conversation is in progress, new conversations won’t start until the previous is done.  One of the stretch challenges I set was to also have an event to stop an active conversation if the player got too far away 😀

Simon (Darkside) Jackson