playMaker

Author Topic: Destroy Object action only destroying first clone? [SOLVED]  (Read 2182 times)

dubnug

  • Playmaker Newbie
  • *
  • Posts: 22
Hello!

I'm running into an issue with the Destroy Object action (or how I'm using it  ;D).

I have a prefab in my assets that's being instantiated as a clone when it's dragged into the scene. So a user could pull out 5 or 10 of the same object from our UI "item library" and it'll just instantiate duplicates/clones. I have a button with an FSM that listens for a touch object event then, once fired, it'll destroy the global variable GameObject that the prefab is connected to (via Get Property).

Only issue is, it seems that only the 'first' clone instantiated is getting destroyed.. not all of the clones instantiated. I need them all to be destroyed. Is there a better way to solve this?

« Last Edit: August 27, 2014, 07:09:11 AM by Lane »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Destroy Object action only destroying first clone?
« Reply #1 on: June 11, 2014, 07:56:32 AM »
Hi,

 yes, nothing wrong with this action, it's by design that it will only destroy the first gameobject it finds.

 I would implement a logic on the gameobject itself, and a global event "DESTROY OBJECT X" for example, and so all objects implementing this global event will be able to destroy themselves.

 This approach is very powerful, cause each object can then decide what to do based on its own properties and context.

bye,

Jean

semie

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Destroy Object action only destroying first clone?
« Reply #2 on: August 26, 2014, 09:21:27 PM »
Just wanted to say thanks to OP for posting the question and thanks to Jean for his response.