GameObject Parent

robot_2Generated
code_blocksInput

Description

The Parent field in the CloneConfig struct specifies the parent GameObject for the cloned object. This field is used to determine the hierarchy placement of the cloned object within the scene. If set, the cloned object will be a child of the specified GameObject.

Usage

To use the Parent field, assign it a GameObject instance that you want to be the parent of the cloned object. This is typically done when setting up the configuration for cloning a GameObject.

Example

// Example of using the Parent field in CloneConfig

// Assume 'originalObject' is a GameObject that you want to clone
GameObject originalObject = ...;

// Create a new CloneConfig
CloneConfig config = new CloneConfig();

// Set the parent GameObject for the clone
config.Parent = someParentGameObject;

// Clone the original object with the specified configuration
GameObject clonedObject = originalObject.Clone(config);

// The clonedObject will now be a child of 'someParentGameObject'