- Home /
other.SendMessage not Working!
So this is part of the script applied to a wall (Cube gameObject): function OnParticleCollision (other : GameObject) {
other.SendMessage("destroythosecubes");
}
I have a lazerbeam which shoots particles which spawn objects (cubes in this case) This is the script attached to the cube:
function destroythosecubes () { print ("particle collide"); Destroy (gameObject); }
When I shoot at a wall it says SendMessage.destroythosecubes has no reciever. Why is this?
Answer by Bunny83 · Mar 15, 2013 at 09:28 AM
Simply because you send the message to the wrong gameobject ^^. Your script is probably attached to a different object, maybe a child object. You can use BroadcastMessage if you want to reach child objects as well. Note: If you send the message to a child object but the script is attached to a parent you could use SendMessageUpwards.
no luck for both. the wall and the lazerbeam are to seperate objects, no children or parents