Sending Messages via Component
Using GlobalMessage’s MessageSender component allows you to send Messages without the need to edit or create code and components. This is especially useful in situations where you just want to augment existing systems with the ability to send Messages without changing their underlying code.
The MessageSender component is used by assigning its SendGlobalMessage method to UnityEvents of other components. Of course, you could also call the method directly from code. In this case, Sending Messages via EMO Reference is probably the better approach.
In the following example, the MessageSender component is used to send a Message whenever a Unity UI Button component invokes its OnClick event.
In the Editor, add the MessageSender component to the desired GameObject. Then, select the EMO you want to send.
In the other component’s UnityEvent (in our case the Button), reference the MessageSender component and set its SendGlobalMessage method.
Now, whenever Button's OnClick event is invoked, it triggers MessageSender to send its assigned EMO.
Sending Messages with Parameter
Sending Messages with parameter via the MessageSender component, essentially works the same. The only difference is that you have to set the parameters properties to their desired values when you select the EMO in the MessageSender component. This only works for parameters that support full Editor integration.
Note
At the moment, it is not possible to send dynamic parameter values via MessageSender component. If you need this functionality, checkout Sending Messages via EMO Reference or Sending Messages via Code Only.