Cannot destroy GameObject while it is being activated or deactivated.

Cannot destroy GameObject while it is being activated or deactivated.

What does it mean ? How can i check object is being activated or deactivated ?

I want to destroy gameobject on OnDisable(). How can i do that ?

you may use;

void OnDisable(){
    foreach(Transform t in transform){
        Destroy(t.gameObject);
    }
}