![]() |
Init(args)
Scripting Reference
|
◆ InitTargetAsync()
Initializes the client object of type TClient asynchronously with the arguments specified by this initializer. The method will wait until all dependencies of the client are ready, and only then initialize the target. For example, if one of the dependencies is an addressable asset, the method can wait until the asset has finished loading, and then pass it to the client's Init method. Note that if any dependency requires asynchronous loading, and the client is a component attached to an active scene object, then initialization event functions like Awake, OnEnable and Start can get called for the target before initialization has finished. If IInitializer.Target is attached to the same GameObject as the initializer, then this method initializes the IInitializer.Target and returns it. If IInitializer.Target is attached to a different GameObject than the initializer, like for example a different prefab, then this method clones the IInitializer.Target, initializes the clone, and returns it. If IInitializer.Target is This method should be idempotent, meaning that if it is called multiple times, it should always return an awaitable with the same result, the result object should only get initialized once.
Implements Sisus.Init.IInitializer. |