- Home /
Broadcast message
Hello,
I've got a very simple question:
How do you use Broadcastmessage? I do not understand the script reference, could someone explain it to me please?
Hybris
Answer by Berenger · Jan 27, 2012 at 05:09 PM
The point of those message is to call a function on every components of a gameObject and of all it's hierarchy (SendMessageUpwards for parents).
For instance, if you have an Object named Mummy (very important for my metaphore :p) with the component Cook, you can use BroadcastMessage( "DinerTime" ) to all the children of Mummy. If they happen to have a script with a function DinerTime attached, it will be called for each of them.
It actually sends the message to the parent AND all children.
Broadcast$$anonymous$$essage doesn't send to the parents, only the object itself and it's children. Send$$anonymous$$essage send to all the components of the object only, and Send$$anonymous$$essageUpwards send to object + parent.
And in what object do you send a message? And do you send only to the children of the gameobject or can you send messages to any gameobject?
Your answer
![](https://koobas.hobune.stream/wayback/20220613063450im_/https://answers.unity.com/themes/thub/images/avi.jpg)