Hi everyone, I have a problem with broadcasting message. Even when I put in the receiver script in its’ child, unity still tells me “BroadcastMessage has no Receiver!” error, so my scripts don’t work as well.
Here is my code on the parent:
public void SetPlayerName(InputField playername)
{
this.playername = playername.text; //this.playername is where I store the name data
BroadcastMessage("SendName", this.playername, SendMessageOptions.RequireReceiver);
}
Here is my receiver code in the child script:
void SendName(string playername)
{
this.playername = playername;//this.playername is another string variable where I store my playername data in the child
}
And I’m sure I put the receiver gameobject as the broadcaster’s child.
(Tank is the parent, and PlayerInfos is the child).
Can anyone help me with that?