升级obi

This commit is contained in:
2026-01-22 22:08:21 +08:00
parent 120b8cda26
commit 20f14322bc
1067 changed files with 149894 additions and 29583 deletions

View File

@@ -48,7 +48,7 @@ public class CoroutineJob{
private bool stop;
private Exception e;
public int asyncThreshold = 0; //Time in milliseconds that must pass before job switches to async mode. By default, the job is asynchronous from the start.
public int asyncThreshold = 250; //Time in milliseconds that must pass before job switches to async mode. By default, the job is asynchronous from the start.
private void Init(){
isDone = false;

View File

@@ -6,38 +6,31 @@ using System.Collections;
namespace Obi
{
public class EditorCoroutine
{
public class EditorCoroutine
{
public static bool ShowCoroutineProgressBar(string title, IEnumerator coroutine)
{
public static void ShowCoroutineProgressBar(string title, ref IEnumerator coroutine){
bool cancelled = false;
#if (UNITY_EDITOR)
if (coroutine != null){
while (coroutine.MoveNext() && !cancelled)
{
var progressInfo = coroutine.Current as CoroutineJob.ProgressInfo;
cancelled |= EditorUtility.DisplayCancelableProgressBar(title, progressInfo.userReadableInfo, progressInfo.progress);
}
// once finished, set coroutine to null and clear progress bar.
coroutine = null;
EditorUtility.ClearProgressBar();
}
#endif
return cancelled;
}
#if (UNITY_EDITOR)
if (coroutine != null){
CoroutineJob.ProgressInfo progressInfo;
do{
if (!coroutine.MoveNext())
progressInfo = null;
else
progressInfo = coroutine.Current as CoroutineJob.ProgressInfo;
if (progressInfo != null && EditorUtility.DisplayCancelableProgressBar(title, progressInfo.userReadableInfo, progressInfo.progress)){
progressInfo = null;
}
}while (progressInfo != null);
// once finished, clear progress bar and set coroutine to null.
coroutine = null;
// Unity bug here: https://issuetracker.unity3d.com/issues/unity-throws-nullreferenceexception-or-endlayoutgroup-errors-when-editorutility-dot-clearprogressbar-is-called
EditorUtility.ClearProgressBar();
}
#endif
}
}
}
}