private void MoveNextUnity()
{
try
{
// run next part of the user routine;
var result = _innerRoutine.MoveNext();
if (result)
{
// something has been yield returned, handle it;
SetPendingCurrentObject(_innerRoutine.Current);
GotoState(RunningState.PendingYield);
}
else
{
// user routine simple done;
GotoState(RunningState.Done);
}
}
catch (System.Exception ex)
{
// exception handling, save & log it;
this.Exception = ex;
Debug.LogError(string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
// then terminates the task;
GotoState(RunningState.Error);
}
}
}