From 7719e77b77c719718dd0f098a3ddd1373e97c870 Mon Sep 17 00:00:00 2001 From: ninemine <1371605831@qq.com> Date: Thu, 18 Dec 2025 15:13:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B=E6=BC=8F?= =?UTF-8?q?=E6=B4=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Convention/[Runtime]/Config.cs | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/Convention/[Runtime]/Config.cs b/Convention/[Runtime]/Config.cs index 661b81f..2db558e 100644 --- a/Convention/[Runtime]/Config.cs +++ b/Convention/[Runtime]/Config.cs @@ -1334,14 +1334,19 @@ namespace Convention while (loadingTask.Count > 0) { // 防止大量无延迟函数的使用导致假死机 - //if (Time.realtimeSinceStartup - CoroutineStarter.waitClock > maxWaitClock) + if (Time.realtimeSinceStartup - CoroutineStarter.waitClock > maxWaitClock) { yield return null; } if (loadingTask.Peek().MoveNext()) { - if (loadingTask.Peek().Current is IEnumerator next) + var current = loadingTask.Peek().Current; + if (current is IEnumerator next) loadingTask.Push(next); + else if (current is YieldInstruction yieldInstruction) + yield return yieldInstruction; + else if (current is CustomYieldInstruction customYieldInstruction) + yield return customYieldInstruction; } else { @@ -1362,7 +1367,7 @@ namespace Convention // 防止大量无延迟函数的使用导致假死机 if (Time.realtimeSinceStartup - CoroutineStarter.waitClock > maxWaitClock) { - yield return null; + yield return ir.Current; } } } @@ -2698,7 +2703,7 @@ namespace Convention public static void SerializeNativeArray(BinaryWriter writer, in NativeArray array, int start = 0, int end = int.MaxValue) { - int e = Mathf.Min(array.Length, end); + int e = Mathf.Min(array == null ? 0 : array.Length, end); writer.Write(e - start); while (start < e) { @@ -2718,7 +2723,7 @@ namespace Convention } public static void SerializeArray(BinaryWriter writer, in int[] array, int start = 0, int end = int.MaxValue) { - int e = Mathf.Min(array.Length, end); + int e = Mathf.Min(array == null ? 0 : array.Length, end); writer.Write(e - start); while (start < e) { @@ -2742,7 +2747,7 @@ namespace Convention public static void SerializeNativeArray(BinaryWriter writer, in NativeArray array, int start = 0, int end = int.MaxValue) { - int e = Mathf.Min(array.Length, end); + int e = Mathf.Min(array == null ? 0 : array.Length, end); writer.Write(e - start); while (start < e) { @@ -2762,7 +2767,7 @@ namespace Convention } public static void SerializeArray(BinaryWriter writer, in float[] array, int start = 0, int end = int.MaxValue) { - int e = Mathf.Min(array.Length, end); + int e = Mathf.Min(array == null ? 0 : array.Length, end); writer.Write(e - start); while (start < e) { @@ -2786,7 +2791,7 @@ namespace Convention public static void SerializeArray(BinaryWriter writer, in string[] array, int start = 0, int end = int.MaxValue) { - int e = Mathf.Min(array.Length, end); + int e = Mathf.Min(array == null ? 0 : array.Length, end); writer.Write(e - start); while (start < e) { @@ -2810,7 +2815,7 @@ namespace Convention public static void SerializeNativeArray(BinaryWriter writer, in NativeArray array, int start = 0, int end = int.MaxValue) { - int e = Mathf.Min(array.Length, end); + int e = Mathf.Min(array == null ? 0 : array.Length, end); writer.Write(e - start); while (start < e) { @@ -2837,7 +2842,7 @@ namespace Convention } public static void SerializeArray(BinaryWriter writer, in Vector3[] array, int start = 0, int end = int.MaxValue) { - int e = Mathf.Min(array.Length, end); + int e = Mathf.Min(array == null ? 0 : array.Length, end); writer.Write(e - start); while (start < e) { @@ -2868,7 +2873,7 @@ namespace Convention public static void SerializeNativeArray(BinaryWriter writer, in NativeArray array, int start = 0, int end = int.MaxValue) { - int e = Mathf.Min(array.Length, end); + int e = Mathf.Min(array == null ? 0 : array.Length, end); writer.Write(e - start); while (start < e) { @@ -2893,7 +2898,7 @@ namespace Convention } public static void SerializeArray(BinaryWriter writer, in Vector2[] array, int start = 0, int end = int.MaxValue) { - int e = Mathf.Min(array.Length, end); + int e = Mathf.Min(array == null ? 0 : array.Length, end); writer.Write(e - start); while (start < e) {