here is the code of the missile
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bullet : MonoBehaviour
{
// Start is called before the first frame update
public BoxCollider boxCollider;
public GameObject explosionParticle;
void update()
{
}
private void OnTriggerEnter(Collider other)
{
if(!other.CompareTag(tag))
{
Debug.Log("collidé");
Explode();
}
}
void Explode()
{
GameObject explosion = Instantiate(explosionParticle, gameObject.transform.position, Quaternion.identity);
explosion.GetComponent<ParticleSystem>().Play();
Destroy(gameObject);
Destroy(explosion,2);
}
}