Documentation

Support

Unity Studio

Open Unity Studio

Unity Studio

Instantiate node - expression

Create a new instance of a specified GameObject in the scene and return the new GameObject.
Read time 2 minutesLast updated 19 days ago

Use the Instantiate node to create a new copy of an object during play. This is useful if you want to spawn assets or UI elements whenever you need them.

Socket

Type

Description

Object
GameObject
The object to duplicate. When the node runs, it creates a new copy of this object. The new object uses the original’s default position and rotation. You can move or rotate it afterward with other nodes.

Variables

Expand the Instantiate node to view available variables you can use:

Variable

Type

Description

position
Vector3
The position where the new GameObject will be created in the scene. By default, it uses the original object's position, but you can specify a different position if needed.
rotation
Quaternion
The rotation of the new GameObject when it's created. By default, it uses the original object's rotation, but you can specify a different rotation if needed.
scale
Vector3
The scale of the new GameObject when it's created. By default, it uses the original object's scale, but you can specify a different scale if needed.
transform
Transform
The Transform component of the new GameObject. This is useful for modifying the position, rotation, or scale of the new object after it's created.
name
string
The name of the new GameObject. By default, it uses the original object's name with
(Clone)
appended to it, but you can specify a different name if needed.
activeSelf
bool
A Boolean that indicates whether the new GameObject is active in the scene. By default, it uses the original object's active state, but you can specify a different state if needed.

Methods

Expand the Instantiate node to view available methods you can use:

Method

Description

SetActiveA method that allows you to enable or disable the new GameObject in the scene. This is useful for controlling when the object should be visible or interactable after it's created.
GetComponentA method that allows you to access a specific component on the new GameObject. This is useful for modifying the behavior or properties of the new object immediately after it's created, such as changing its color or adding a script.
AddComponentA method that allows you to add a new component to the new GameObject. This is useful for dynamically adding functionality to the new object after it's created, such as adding a Rigidbody for physics interactions or a Collider for collision detection.
To stringA method that returns a string representation of the new GameObject, including its name and position. This can be useful for debugging or logging purposes to understand what object was created and where it is in the scene.

Additional resources