Search Unity

Unity (clones) not destroying after unplay

Discussion in 'Editor & General Support' started by tomtominc, May 28, 2014.

  1. tomtominc

    tomtominc

    Joined:
    Nov 7, 2013
    Posts:
    22
    So am i crazy to think that the (clone) objects get destroyed after i uncheck the play button in unity?
    Okay this is my code to Instantiate maybe I'm doing it wrong ...

    Code (csharp):
    1. public Transform InitSpellClone(string n, string code){
    2.  
    3.         Transform clone = Instantiate (allSpells [n]) as Transform;
    4.         clone.GetComponent<Spell> ().code = code;
    5.         clone.parent = GameObject.Find ("SpellHolder").transform;
    6.         return clone;
    7.     }
    allSpells is a dictionary of spells and I place the name of the spell as n.
    I make it the child of a obj called SpellHolder this is just so my inspector doesn't become large.
    I tried to not make it a child of anything and it still wouldn't delete so thats not it.