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 )

robot_2Generated
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.

Usage

To use the Clone method, call it on an instance of a GameObject and pass a reference to a CloneConfig object. The method will return a new GameObject that is a copy of the original, with modifications as specified by the CloneConfig.

Example

// Example of cloning a GameObject with a specific CloneConfig

// Assume 'originalGameObject' is an existing GameObject
CloneConfig cloneConfig = new CloneConfig();
// Configure cloneConfig as needed

GameObject clonedGameObject = originalGameObject.Clone(ref cloneConfig);

// 'clonedGameObject' is now a unique copy of 'originalGameObject' with the specified configurations.