Пример #1
0
 /// make sure that this item will be initialised at least one frame after it is enabled and the scene is loaded
 protected virtual void OnEnable()
 {
     AssetsWaitingInitialisation.Push(this);
     if (AssetsWaitingInitialisation.Count == 1)
     {
         InitialiseAssetEmitter.Fire();
     }
 }
Пример #2
0
 private static void InitialiseCustomAssetsFiber() =>
 // Permanently running fiber that waits until an asset requires initialising before looping back on itself.
 Fiber.Start().OnFixedUpdates.Begin.Do(
     _ => {
     while (!AssetsWaitingInitialisation.Empty)
     {
         AssetsWaitingInitialisation.Pop().Initialiser();
     }
 }, "CustomAsset Initialiser").WaitFor(InitialiseAssetEmitter).Again.Finish();