InstantiateParameters
Parameters for Object.Instantiate and Object.InstantiateAsync.
Read time 2 minutesLast updated 5 days ago
Definition
- Type: Struct
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
public struct InstantiateParameters
Remarks
This structure is used in Object.Instantiate and Object.InstantiateAsync in order to provide maximum flexibility in the parameters you provide. It has the added benefit of unifying the meaning of the parameters in both methods.
The behaviour of the different parameter combinations is:
- Default: The instance will have the same local position and rotation as the original, it won't have a parent and it will be in the active scene.
- : The instance will have the same world position and rotation as the original.
worldSpace - Default, method takes position and rotation: Sets those values to the transform of the instance in local space.
- , method takes position and rotation: Sets those values to the transform of the instance in world space.
worldSpace - : The instance will be a child of
parentand will have the same local position and rotation as the original.parent - and
parent: The instance will be a child ofworldSpaceand will have the same world position and rotation as the original.parent - , method takes position and rotation: The instance will be a child of
parentand the values will be set as local.parent - and
parent, method takes position and rotation: The instance will be a child ofworldSpaceand the values will be set as world space.parent - and any combination of position, rotation and
scene: The same behaviour as that combination, but the instance will be inworldSpace.scene - and
scene:parentwill be ignored because child objects are always in the same scene as thescene.parent
Fields
Value | Description |
|---|---|
| originalImmutable | It tells the InstantiateAsync if it's safe to do the serialization step async. |
| parent | The desired parent. |
| scene | The desired scene. |
| worldSpace | Choose between world space or local space. |