Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: rizwanash on July 05, 2019, 03:43:07 AM
-
Hey guys,
I would like to know what is the easiest and/or safest way to destroy spawned objects in the scene, for e.g. Bullets and particles etc. destroy object seems to be removing first one only which is of course how it is set to do. is there any way we can collect all of the clones being created and then destroy them?
Thanks
-
Hi,
many ways:
-- you make a manager that maintain a list of the clones, and then it can destroy them all, because it can go through that list
-- parent all clones to the same gameobject, then you can destroy just the parent
-- make a global event "DESTROY XXX" and any fsm listening to that will then destroy itself, which probably the most effective and direct way, because more fsm can listen to this yet act differently depending on the context, and exceptions are easy to make. I use this a lot myself
Bye,
Jean
-
Where should i start this event Destroy Bullets lets say, when it spawns right after that or when i destroy first object ?
-
Hi,
When you want to destroy it.
Bye,
Jean
-
Alright, Thanks very much....
-
Hi.
For bullets you might want to look into pooling them instead of create/destroy
There is a set of pooling actions called pooler it's not very advanced but i can do the job.
i am using pooler in this tutorial :