This commit is contained in:
CortexCore
2025-03-05 22:28:38 +08:00
parent 268c24de0d
commit e846296fca
56 changed files with 449323 additions and 573736 deletions

View File

@@ -14,6 +14,7 @@ namespace BITKit.OpenWorld
{
public class WorldTerrainBehaviour : MonoBehaviour,IWorldChunkObject
{
public static UniTaskCompletionSource WaitUntilInitialized = new();
[SerializeReference, SubclassSelector] private IReference sceneName;
[SerializeField] private Vector3 size;
[SerializeField] private Vector3 position;
@@ -26,7 +27,15 @@ namespace BITKit.OpenWorld
var stopWatcher = new System.Diagnostics.Stopwatch();
stopWatcher.Start();
_sceneHandle = YooAssets.LoadSceneAsync(sceneName.Value,LoadSceneMode.Additive,priority:8);
await _sceneHandle;
try
{
await _sceneHandle.WithCancellation(destroyCancellationToken);
}
catch (OperationCanceledException)
{
}
stopWatcher.Stop();
Debug.Log($"加载场景 {sceneName.Value} 耗时 {stopWatcher.ElapsedMilliseconds}ms");
}