// ProjectileDamage.cs using UnityEngine; public class ProjectileDamage : MonoBehaviour { public float damage = 10f; private void Start() { this.gameObject.GetComponent().go = this.gameObject; } void OnTriggerEnter(Collider other) { if (other.TryGetComponent(out var target)) { this.gameObject.GetComponent().Impact(); target.ApplyDamage(damage); } Destroy(gameObject); } }