A simple script if your game is more simple below
using UnityEngine;
public class AttackTarget : MonoBehaviour
{
public int health = 100;
public GameObject attackTrailEffect;
public void TakeDamage(int damageAmount)
{
health -= damageAmount;
if (health <= 0)
{
Die();
}
}…Read more