Changing parent after deactivation error?

For my resource management, I’m trying to return my resources to a parent object upon deactivation, like so:

void OnDisable() {

Everything seems to run as expected, apart from, when setting the parent, it throws the error “GameObject is already being activated or deactivated.”

Does anyone know as to why this error shows, or anyway to disable it?

Got the same problem - firstly I deactivate an object, later on I want to change its parent. Anybody can help ? As I understand , I can’t change the parent at the time when game object is being deactivated.
What’s more weird, everything is working properly , but the big red error in the console appears…