- Home /
Question by
Anxo · Sep 09, 2010 at 06:29 PM ·
sendmessagebroadcastmessage
BroadcastMessage from one Object to another ?
Hi, This might be a noob questions but have not found the answer in the documents. Maybe I am looking for it wrong but lets say I have 2 objects, Object A and Object B, Object B has a function called.... "blue" and object be has a collision detection with.. what I want to do is, if Object A lets say hits a wall, it tells Object B to execute function "blue".
The way BroadcastMessage works on game objects and its children, It would be perfect if I could do this without making the object a child of another.
Any ideas?
Comment
Best Answer
Answer by AliAzin · Sep 09, 2010 at 06:36 PM
you should reference your target object in a variable like this:
var target : GameObject;
target.BroadcastMessage("blue");
aww man, how silly do I feel right now. duh, Thank you for your time.