Reply To: Ch 5 worry – MessagingManager not firing

Home Forums Books Mastering Unity 2D Game Development Ch 5 worry – MessagingManager not firing Reply To: Ch 5 worry – MessagingManager not firing

#6280

Hi Andrew.  First off, thanks for being a supporter of my book :D.

Right, Messaging Manager.

The first version of the Messaging Manager on page 145, is a simple example which can be attached to any GameObject in a scene to run. In this instance the Awake function will run because it is based on the MonoBehaviour class (which Unity uses for all the management functions, Awake, Start, Update, Draw, etc)

So there shouldn’t be any reason the Awake call wouldn’t fire when you attach it to any GameObject in a scene.  For example, if you attach the following script to any GameObject in a scene, the awake function will fire and a console message should be logged:

Now later in Ch 5 we also introduce another pattern using a Singleton Manager in the Conversation Manager

public class ConversationManager : Singleton<ConversationManager>

(I also updated the Messaging Manager script in the code in Ch 6 to this method as it means you no longer need to manually add it to the scene)

In this mode the Script does not Awake until the first time it is called, i.e. when the first event is fired.

Hope this helps.

Simon (Darkside) Jackson
@SimonDarksideJ