Damage.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Damage : MonoBehaviour
{
public GameObject Explosion;
void Start()
{
}
void Update()
{
}
void OnTriggerEnter(Collider collision)
{
if (collision.gameObject.tag == "Ball")
{
Instantiate(Explosion, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity);
Destroy(this.gameObject);
}
}
}