get component in parent unity code example
Example 1: parent unity
public gameobject player
public gameobject Newparent
player.transform.parent = newParent.transform;
Example 2: how to get parent gameobject in unity
childObject.transform.parent.gameObject