unity children transform to parent code example
Example 1: unity change parent in script
player.transform.parent = newParent.transform;
Example 2: transform object according to its parent unity
transform.localPosition = new Vector3(12.5f, 12.5f, 12.5f);