public GameObject Child;
public Transform NewParent;
// Sets "newParent" as the new parent of the child GameObject.
Child.transform.SetParent(NewParent);
// Removes parent, puts child into a top-level object in the hierarchy
Child.transform.SetParent(null);