Hello folks! I am creating a top-down shooter and I just set up shooting but when my bullets hit the enemy it doesn't destroy it or the enemy.
public class bullet : MonoBehaviour
{
public GameObject enemy;
private void OnCollisionEnter2D(Collision2D collision)
{
Destroy(gameObject);
Destroy(enemy);
}
}
↧