using HurricaneVR.Framework.Components; using UnityEngine; public class DestroyedInstance : MonoBehaviour { public HVRDamageHandler handler; public GameObject prefab; public float timerToDestroyPrefab; private void Awake() { handler = GetComponent(); } private void OnDestroy() { if (!handler) return; if (handler.Life > 0) return; var inst= Instantiate(prefab, transform.position, Quaternion.identity); Destroy(inst, timerToDestroyPrefab); } }