Im not talking about a script you write your self. Im talking about something like an Image, or a Collider.
Is there anyway to do something like subcribe to the event of when those get called on the components?
For example, right now I would do this with a collider by creating a script that manages disabling and enabling a collider.
ColliderManager : Monobehavior {
Collider c;
public event Action<Collider> OnColliderDisable = delegate { };
public event Action<Collider> OnColliderEnable = delegate { };
OnValidate(){
c = GetComponent<Collider>();
}
public void DisableComponent(){
c.enabled = false;
OnColliderDisable(c);
}
public void EnableComponent(){
c.enabled = true;
OnColliderEnable(c);
}
}
Now I can subscribe to when the collider gets disabled for certain weird situations where I disable a collider and the OnTriggerExit does not get called, but I must maintain that I only ever disable or enable colliders through this script.
Anyone know of a different way to accomplish this?