unity script's parent code example
Example 1: unity change parent in script
player.transform.parent = newParent.transform;
Example 2: parent unity
public gameobject player
public gameobject Newparent
player.transform.parent = newParent.transform;