playMaker

Author Topic: Can't get destroy object to work  (Read 2292 times)

nrhyde

  • Playmaker Newbie
  • *
  • Posts: 5
Can't get destroy object to work
« 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.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Can't get destroy object to work
« Reply #1 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

nrhyde

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Can't get destroy object to work
« Reply #2 on: July 18, 2015, 05:12:43 PM »
Thanks, I made those two changes and it worked!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Can't get destroy object to work
« Reply #3 on: July 19, 2015, 02:34:06 AM »
Hi,
Don't forget that broadcast all will trigger all the global transitions with that name.