playMaker

Author Topic: Destroy Clone Object [SOLVED]  (Read 7121 times)

Fahrettin

  • Junior Playmaker
  • **
  • Posts: 62
  • Noob
Destroy Clone Object [SOLVED]
« on: July 30, 2014, 08:07:42 AM »
Hi friends.
When i destroy my enemy object it plays particle effect. After that i have a long list of clones on hierarchy tab (but not on screen). Will they affect performance? or do i need to destroy them? if yes how can i destroy clones ?
« Last Edit: August 26, 2014, 05:05:00 PM by Fahrettin »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Destroy Clone Object
« Reply #1 on: July 30, 2014, 08:26:47 AM »
Its important to have cleanup after spawning objects, usually by having something manage them all and destroy them/despawn to pool, or to have the individual object destroy itself/despawn to pool.

You'll notice a performance problem depending on how many objects you don't cleanup so its important to plan it in early.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Fahrettin

  • Junior Playmaker
  • **
  • Posts: 62
  • Noob
Re: Destroy Clone Object
« Reply #2 on: July 30, 2014, 08:52:25 AM »
Thanks for the reply. I got the performance part.
I cant manage to delete clone objects. Destroy game object is trying to destroy prefab. Editor stops and says "Destroying assets is not permitted to avoid data loss."

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Destroy Clone Object
« Reply #3 on: July 30, 2014, 09:11:20 AM »
You have to reference the object that's in the scene. The Project Hierarchy and Prefabs are like a library, when you spawn an object it goes into the library, copies the book and throws that copy in the Scene. You can't destroy the books in the library, only the copies..

Since you can only destroy the copies you have to design the original prefab to cleanup itself at some point or have the a manager of some sort clean up the copies, like a Pooling System.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Fahrettin

  • Junior Playmaker
  • **
  • Posts: 62
  • Noob
Re: Destroy Clone Object
« Reply #4 on: July 30, 2014, 04:14:20 PM »
Thanks again.
I found 2 lines of code. After that i used Send Message action. Now it works.
No clones :)

noobcyborg

  • Playmaker Newbie
  • *
  • Posts: 1
Re: Destroy Clone Object
« Reply #5 on: August 04, 2014, 05:35:27 PM »
I try some easy to destroy clone object and yeah. no coding
1. Put FSM in Original object.
2. create Variables with type GameObject
3. add action Find game object in object name put name of original object and type (Clone) behind.  use Store line with variable that you just create
4. add action Destroy Game Object in gameobject line choose that variable in dropdown menu
5. and it will be destroy only clone object without destroy original object

miketolsa

  • Playmaker Newbie
  • *
  • Posts: 22
  • Just love playmaker !!!
    • 4Buffs Productions
Re: Destroy Clone Object [SOLVED]
« Reply #6 on: July 14, 2015, 07:10:33 AM »
I tried the method given by noobcyborg & its working but some how is it possible to delete single object from the rest of the clone using the same method ?

ex - I have create 20 clones of a single prefab(box) with tag "box" now I want to delete any one of the box using the same tech above ..... but what happnes that it delete all the box/clones of the prefab at once ???

did anyone find any solution for this ?