diff --git a/Core/Scripts/IO/ImporterContext.cs b/Core/Scripts/IO/ImporterContext.cs index 5a709dc..e62f7eb 100644 --- a/Core/Scripts/IO/ImporterContext.cs +++ b/Core/Scripts/IO/ImporterContext.cs @@ -398,6 +398,28 @@ public void Load() schedulable.ExecuteAll(); } + public IEnumerator LoadCoroutine(Action onLoaded, Action onError = null) + { + if (onError == null) + { + onError = Debug.LogError; + } + + var schedulable = LoadAsync(); + foreach (var x in schedulable.GetRoot().Traverse()) + { + while (true) + { + var status = x.Execute(); + if (status != ExecutionStatus.Continue) + { + break; + } + yield return null; + } + } + } + public void LoadAsync(Action onLoaded, Action onError = null) { if (onError == null)