This question was 
             closed May 26, 2017 at 07:15 PM by 
             Skorpion5789 for the following reason: 
             
 
            I found answer.
 
               Question by 
               Skorpion5789 · May 28, 2017 at 03:20 PM · 
                rigidbodyinstantiateshootingclone  
              
 
              Script removing rigidbody component, NOT game object
Hi, I'm creating a simple game, and I can't kill cloned object with rigidbody component. Script just deletes rigidbody component. Here's the code:
 public class ShooterProt : MonoBehaviour
 {
     public Rigidbody projectile;
     public Transform BarrelEnd;
     [SerializeField]protected float ShootForce = 2000f;
     void Update()
     {
         if (Input.GetButtonDown("Fire1"))
         {
             Shoot();
         }
     }
     void Shoot() {
         Rigidbody clone;
 
         clone = Instantiate(projectile, BarrelEnd.position, BarrelEnd.rotation) as Rigidbody;
         clone.AddForce(BarrelEnd.forward * ShootForce);
         Object.Destroy(clone, 1f);
     }
 }
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Skorpion5789 · May 26, 2017 at 07:15 PM
Ah, I just did Destroy(gameobject); in other script.
 using UnityEngine;
 
 public class Kill : MonoBehaviour {
 
     private void OnCollisionEnter(Collision col)
     {
         if (col.collider.name == "Zombie") {
             Destroy(gameObject);
         }
     }
 }
Follow this Question
Related Questions
Cant Get a Bullet to Shoot (C#) 2 Answers
Set up time between each instantiated object? 2 Answers
Bullet clones will not be destroyed. 2 Answers
How to get the position of a new Instantiated prefab 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                