Is there such thing as on destroy, so as the object is being destroyed trigger that function? Any thoughts?
before you destroy the object create a function that does the required stuff you need. I like to make functions like something like this
(somescript).OnDestory();
Destroy(this.gameObject);
OR
(somescript).OnDestory(GameObject something here);
void OnDestory(Gameobject destory_this){
///stuff here
Destroy(destory_this);
}
Just how I script
Unity - Scripting API: MonoBehaviour.OnDestroy() The docs are your friend…
–Eric