BroadcastMessage between children?

If I have a hierarchy:

-Parent
–ChildOne
–ChildTwo

Can ChildTwo have a BroadcastMessage on it that ChildOne can “hear”?

Yes, it’s called SendMessageUpwards() :slight_smile:

EDIT: Or did you mean laterally (eg: a child on the same level of the hierarchy?) Because BroadcastMessage should do that by default.

The answer is yes, but you have to reference that child.

var target : GameObject;

function Start()
{
    target.BroadcastMessage("ClassToCall");
}

Depending on your other requirements, you could send the message from ChildOne’s parent, or even its root (in case the hierarchy was many layers deep). e.g.

childOne.transform.parent.BroadcastMessage(...);

or

childOne.transform.root.BroadcastMessage(...);