- Home /
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() {
transform.SetParent(obj.transform);
}
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?
Answer by NotNew · Aug 11, 2020 at 05:31 PM
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...
Your answer
![](https://koobas.hobune.stream/wayback/20220612100700im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
JCar & FPS/TPS controller 1 Answer
iTween moving all children the same way the parent object does 0 Answers
Manipulating Instanced Object 2 Answers
i want the camera stop follwing my player only on y axis when he jumps... 4 Answers
how to make an objects rotation independent from its parents. 2 Answers