unity get parent of transform code example
Example 1: unity reference parent gameobject
transform.parent.gameObject //Use this to reference the parent of the gameobject
Example 2: how to parent something unity
public GameObject GameObjectYouWantToParent;
public GameObject TheNewParent;
Transform GameObjectsTransform = GameObjectYouWantToParent.transform;
GameObjectsTransform.parent = TheNewParent;