Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
Added ImorterContext.LoadCoroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
ousttrue committed Oct 10, 2018
1 parent d403722 commit a6373aa
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Core/Scripts/IO/ImporterContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,28 @@ public void Load()
schedulable.ExecuteAll();
}

public IEnumerator LoadCoroutine(Action<Unit> onLoaded, Action<Exception> 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<Unit> onLoaded, Action<Exception> onError = null)
{
if (onError == null)
Expand Down

0 comments on commit a6373aa

Please sign in to comment.