Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: nrhyde on July 18, 2015, 05:04:08 AM

Title: Can't get destroy object to work
Post by: nrhyde on July 18, 2015, 05:04:08 AM
I create a series of objects from a prefab (green smiley faces) and then I want to destroy them all.  The way I'm trying to do it is having a global event within the prefab that triggers the object to destroy itself, but it's not working. The smileys just stay on the screen.  I've attached screenshots of the parts of my project with the prefab, where I create the smileys, and where I send the destroy event.  I think the problem is in the way I have the code in the Prefab specifying the object to be destroyed, but I don't know how to fix it.
Title: Re: Can't get destroy object to work
Post by: djaydino on July 18, 2015, 05:58:47 AM
Hi,
instead of destroy object you can use destroy self.

on the 3th picture, the send event you can send broadcast all or you have to find the created object and then use send event.

the reason for this is that it comes from a prefab and you can't communicate directly with prefabs
Title: Re: Can't get destroy object to work
Post by: nrhyde on July 18, 2015, 05:12:43 PM
Thanks, I made those two changes and it worked!
Title: Re: Can't get destroy object to work
Post by: djaydino on July 19, 2015, 02:34:06 AM
Hi,
Don't forget that broadcast all will trigger all the global transitions with that name.