Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: frozze on May 31, 2015, 12:27:45 PM
-
Hi.
How is it possible to use "send message" to all objects with a tag, or within a given radius? Lets say I have a bomb that explodes. It has a radius collider, and everything within that radius gets a send message.
I assume I need to make a for loop, and check if each tag is in range. If the tag matches it will send message. But I'm not sure how to do it.
I think it's this in code:
http://answers.unity3d.com/questions/463020/sendmessage-to-all-tag-within-range.html
best regards
frozze
-
check action: SendEventByTag
@ ecosystem or https://snipt.net/dudebxl/?page=2 (copy/paste into new C# script with same name)
-
Thanks, but where am I supposed to insert the name of the method? "like in send message = method name"
-
mmm not sure i understand but i will give it a try.
1. Select the tag you went to send event to in the action
2. copy the event that will be used by all the gameobjects with target tag (make sure you set the event to global after)
3. paste event name in action at 'or send by..' space in the action
4. put the FSM name from the target gameobjects tag (usually if only one then it is 'FSM' which is the default name) into the action
Now you are good to go. bear in mind this is a solution for all gameobjects with target tag and not for object with target tag in only the collider zone. maybe you should change tag on all object that touch the collider (trigger event) then use this action for the new tag. Or use array list actions.
if you are using a script in your target gameobject then create a global event (and do above) then call the script method() with an another action.
hope it helps