Description
The Parent
property of the GameTransform
class represents the parent GameObject
of the current transform. This property allows you to get or set the parent object, which is useful for managing hierarchical relationships between game objects in a scene.
Usage
To use the Parent
property, you can access it directly from an instance of GameTransform
. Setting this property will change the parent of the current GameObject
, affecting its position, rotation, and scale relative to the new parent.
Example
// Example of using the Parent property
// Assume 'childTransform' is an instance of GameTransform
GameTransform childTransform = new GameTransform();
// Assume 'parentObject' is an instance of GameObject
GameObject parentObject = new GameObject();
// Set the parent of the child transform
childTransform.Parent = parentObject;
// Get the parent of the child transform
GameObject currentParent = childTransform.Parent;