Version: 2022.3
LanguageEnglish
  • C#

AsyncInstantiateOperation

class in UnityEngine

/

Inherits from:AsyncOperation

/

Implemented in:UnityEngine.CoreModule

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

Description

Asynchronous instantiate operation on UnityEngine.Object type.

The operation is used by Object.InstantiateAsync internally and usually wrapped by AsyncInstantiateOperation<T>.

Properties

ResultIf isDone is true, then Result contains the instantiated objects. The size of the array is the same as the 'count' argument for the InstantiateAsync call.

Public Methods

CancelMethod that cancels all the operations connected to the asynchronous instantiation if the operation is not done yet, that is, where isDone == false. This method deletes all the objects created so far, which are not visible to users while they're not activated, and stops all the internal jobs connected to the operation.
IsWaitingForSceneActivationThis property can be true only if allowSceneActivation is set to false, and if the operation has already completed everything needed for object instantiation except for the main thread integrating the objects and calling their Awake methods. Users can set allowSceneActivation to true to trigger the activation or call the Cancel method to cancel instantiation.
WaitForCompletionBlocks the current thread until this operation is done.

Static Methods

GetIntegrationTimeMSGets the target duration allowed per frame to integrate instantiated object operations, in milliseconds.
SetIntegrationTimeMSSets the target duration allowed per frame to integrate instantiated object operations, in milliseconds.

Inherited Members

Properties

allowSceneActivationAllow Scenes to be activated as soon as it is ready.
isDoneHas the operation finished? (Read Only)
priorityPriority lets you tweak in which order async operation calls will be performed.
progressWhat's the operation's progress. (Read Only)

Events

completedEvent that is invoked upon operation completion. An event handler that is registered in the same frame as the call that creates it will be invoked next frame, even if the operation is able to complete synchronously. If a handler is registered after the operation has completed and has already invoked the complete event, the handler will be called synchronously.