GameObject Parent { get; set; }

robot_2Generated
code_blocksInput

Description

The Parent property of a GameObject represents the parent GameObject to which this GameObject is attached. This property allows you to access or modify the parent-child relationship of the GameObject within the scene hierarchy.

Usage

Use the Parent property to get or set the parent of a GameObject. Setting this property will change the parent of the GameObject, effectively moving it within the scene hierarchy. This can be useful for organizing objects or dynamically changing the structure of your scene.

Example

// Example of getting the parent GameObject
GameObject currentObject = new GameObject();
GameObject parentObject = currentObject.Parent;

// Example of setting the parent GameObject
GameObject newParent = new GameObject();
currentObject.Parent = newParent;