Description
The Clone
method creates a unique copy of the current GameObject
. This method allows you to duplicate a GameObject
while applying specific configurations defined in the CloneConfig
parameter. The cloned object will have the same properties and components as the original, but it will be a distinct instance in the scene.
Usage
To use the Clone
method, you need to pass a reference to a CloneConfig
object. This object can specify various options for the cloning process, such as whether to include certain components or modify specific properties of the cloned object.
Example
// Assuming 'gameObject' is an instance of GameObject
CloneConfig cloneConfig = new CloneConfig();
// Configure cloneConfig as needed
GameObject clonedObject = gameObject.Clone(ref cloneConfig);
// 'clonedObject' is now a unique copy of 'gameObject' with the specified configurations