GameObject Clone( Sandbox.CloneConfig& cloneConfig )
static GameObject Clone( string prefabPath, System.Nullable<CloneConfig> config )
static GameObject Clone( string prefabPath, Transform transform, GameObject parent, bool startEnabled, string name )
static GameObject Clone( PrefabFile prefabFile, System.Nullable<CloneConfig> config )
static GameObject Clone( PrefabFile prefabFile, Transform transform, GameObject parent, bool startEnabled, string name )
GameObject Clone( Transform transform, GameObject parent, bool startEnabled, string name )
GameObject Clone()
GameObject Clone( Vector3 position )
GameObject Clone( Vector3 position, Rotation rotation )
GameObject Clone( Vector3 position, Rotation rotation, Vector3 scale )
GameObject Clone( GameObject parent, Vector3 position, Rotation rotation, Vector3 scale )

book_4_sparkGenerated
code_blocksInput

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