Method Instantiate
Instantiate(GameObject, Transform, bool)
Clones the GameObject, original, and returns the clone.
This method also calls GameObjectInstantiated.
Declaration
public static GameObject Instantiate(GameObject original, Transform parent = null, bool worldPositionStays = true)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | original | An existing GameObject that you want to make a copy of. |
| Transform | parent | Parent Transform to assign to the new object. |
| bool | worldPositionStays | Set true to instantiate the new object in world space, which places it in the
same position as the cloned GameObject, or to offset the new object from |
Returns
| Type | Description |
|---|---|
| GameObject | The instantiated clone. |
See Also
Instantiate(GameObject, Vector3, Quaternion)
Clones the GameObject, original, and returns the clone.
This method also calls GameObjectInstantiated.
Declaration
public static GameObject Instantiate(GameObject original, Vector3 position, Quaternion rotation)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | original | An existing GameObject that you want to make a copy of. |
| Vector3 | position | Position for the new object. |
| Quaternion | rotation | Orientation of the new object. |
Returns
| Type | Description |
|---|---|
| GameObject | The instantiated clone. |
See Also
Instantiate(GameObject, Transform, Vector3, Quaternion)
Clones the GameObject, original, and returns the clone.
This method also calls GameObjectInstantiated.
Declaration
public static GameObject Instantiate(GameObject original, Transform parent, Vector3 position, Quaternion rotation)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | original | An existing GameObject that you want to make a copy of |
| Transform | parent | Parent that will be assigned to the new object |
| Vector3 | position | Position for the new object. |
| Quaternion | rotation | Orientation of the new object. |
Returns
| Type | Description |
|---|---|
| GameObject | The instantiated clone |