- Home /
 
 
               Question by 
               valtteri_m · Nov 25, 2014 at 07:25 PM · 
                transformdestroycomponents  
              
 
              Cant destroy object, dont know how to fix help pls
Im not even sure how to search for this but my code: var Player : Transform; var Item : GameObject;
 function OnCollisionEnter2D(coll: Collision2D) {
     if(coll.transform.gameObject.name == "Player")
         var t = GameObject.FindWithTag("Player").transform;
         child = t.Find("Item(Clone)");
         if (child != null) {
             Destroy(child); //this here needs help
                 var Item = Instantiate(Item) as GameObject; {
                 Item.transform.parent = Player;
                 gameObject.transform.parent = Player;
                 gameObject.SetActive(false);
         }
     }
 }
 
               it cant destory the item and the console says: Can't destroy Transform component of 'Player'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Destroying a Transform Component 1 Answer
Can't remove instantiated prefab 0 Answers
instantiate,destroy,gain speed in time 2 Answers
How to diappear a line renderer from start and end position of line 1 Answer
Remove "this" Component 1 Answer