using System.Collections; using System.Collections.Generic; using UnityEngine; public class BulletDestroyer : MonoBehaviour { public GameObject bullet; // Use this for initialization void Start () { bullet = transform.parent.gameObject; } // Update is called once per frame void Update () { } private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Player") { Destroy(bullet.gameObject); } } }