I am having weird behavior in my game where whenever I unparent a child, all of the child's components are turned off. I am trying to unparent the child just before destroying the parent. Any help with this issue would be greatly appreciated.
int i;
for (i = 0; i < this.transform.childCount; i++)
{
if (this.transform.GetChild(i).transform.tag == "Satellite")
{
Debug.Log("Unparented " + this.transform.GetChild(i).name);
this.transform.GetChild(i).parent = null;
}
}
Destroy(this);
}
Here is my code for reference.
↧