set somethings parent unity code example
Example 1: unity change parent in script
player.transform.parent = newParent.transform;
Example 2: how to get parent gameobject in unity
childObject.transform.parent.gameObject
player.transform.parent = newParent.transform;
childObject.transform.parent.gameObject