Version: 2023.2
LanguageEnglish
  • C#

GameObject.InstantiateGameObjects(int,NativeArray<int>,NativeArray<int>,Scene)

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual

Parameters

sourceInstanceID The instance ID of the source GameObject to instantiate.
count The number of copies to create.
newInstanceIDs Pre-allocated NativeArray that will be populated with the instance IDs of the new GameObjects. Must already be the size of count.
newTransformInstanceIDs Pre-allocated NativeArray that will be populated with the instance IDs of the Transforms of the new GameObjects. Must already be the size of count.
destinationScene The Scene to place the instantiated GameObjects into. If default, then the GameObjects will be added to the currently active Scene.

Description

Instantiate a GameObject multiple times by instance ID and populate NativeArrays containing the new GameObjects by instance ID and their corresponding Transforms by instance ID.