diff --git a/Assets/YooAsset/Runtime/ResourceManager/Provider/BundledSceneProvider.cs b/Assets/YooAsset/Runtime/ResourceManager/Provider/BundledSceneProvider.cs
index 4d08889..ff156ae 100644
--- a/Assets/YooAsset/Runtime/ResourceManager/Provider/BundledSceneProvider.cs
+++ b/Assets/YooAsset/Runtime/ResourceManager/Provider/BundledSceneProvider.cs
@@ -8,14 +8,24 @@ namespace YooAsset
{
internal sealed class BundledSceneProvider : ProviderOperation
{
- public LoadSceneMode SceneMode => LoadSceneParams.loadSceneMode;
public readonly LoadSceneParameters LoadSceneParams;
private AsyncOperation _asyncOperation;
private bool _suspendLoadMode;
- public BundledSceneProvider(ResourceManager manager, string providerGUID, AssetInfo assetInfo, LoadSceneMode sceneMode, bool suspendLoad, LocalPhysicsMode physicsMode = default) : base(manager, providerGUID, assetInfo)
+ ///
+ /// 场景加载模式
+ ///
+ public LoadSceneMode SceneMode
{
- LoadSceneParams = new LoadSceneParameters(sceneMode, physicsMode);
+ get
+ {
+ return LoadSceneParams.loadSceneMode;
+ }
+ }
+
+ public BundledSceneProvider(ResourceManager manager, string providerGUID, AssetInfo assetInfo, LoadSceneParameters loadSceneParams, bool suspendLoad) : base(manager, providerGUID, assetInfo)
+ {
+ LoadSceneParams = loadSceneParams;
SceneName = Path.GetFileNameWithoutExtension(assetInfo.AssetPath);
_suspendLoadMode = suspendLoad;
}
diff --git a/Assets/YooAsset/Runtime/ResourceManager/Provider/DatabaseSceneProvider.cs b/Assets/YooAsset/Runtime/ResourceManager/Provider/DatabaseSceneProvider.cs
index c3e2960..85e81bd 100644
--- a/Assets/YooAsset/Runtime/ResourceManager/Provider/DatabaseSceneProvider.cs
+++ b/Assets/YooAsset/Runtime/ResourceManager/Provider/DatabaseSceneProvider.cs
@@ -8,14 +8,24 @@ namespace YooAsset
{
internal sealed class DatabaseSceneProvider : ProviderOperation
{
- public LoadSceneMode SceneMode => LoadSceneParams.loadSceneMode;
- public readonly LoadSceneParameters LoadSceneParams;
- private bool _suspendLoadMode;
+ public readonly LoadSceneParameters LoadSceneParams;
private AsyncOperation _asyncOperation;
+ private bool _suspendLoadMode;
- public DatabaseSceneProvider(ResourceManager manager, string providerGUID, AssetInfo assetInfo, LoadSceneMode sceneMode, bool suspendLoad, LocalPhysicsMode physicsMode = default) : base(manager, providerGUID, assetInfo)
+ ///
+ /// 场景加载模式
+ ///
+ public LoadSceneMode SceneMode
{
- LoadSceneParams = new LoadSceneParameters(sceneMode, physicsMode);
+ get
+ {
+ return LoadSceneParams.loadSceneMode;
+ }
+ }
+
+ public DatabaseSceneProvider(ResourceManager manager, string providerGUID, AssetInfo assetInfo, LoadSceneParameters loadSceneParams, bool suspendLoad) : base(manager, providerGUID, assetInfo)
+ {
+ LoadSceneParams = loadSceneParams;
SceneName = Path.GetFileNameWithoutExtension(assetInfo.AssetPath);
_suspendLoadMode = suspendLoad;
}
diff --git a/Assets/YooAsset/Runtime/ResourceManager/ResourceManager.cs b/Assets/YooAsset/Runtime/ResourceManager/ResourceManager.cs
index bcd1493..894e765 100644
--- a/Assets/YooAsset/Runtime/ResourceManager/ResourceManager.cs
+++ b/Assets/YooAsset/Runtime/ResourceManager/ResourceManager.cs
@@ -86,7 +86,7 @@ namespace YooAsset
/// 注意:返回的场景句柄是唯一的,每个场景句柄对应自己的场景提供者对象。
/// 注意:业务逻辑层应该避免同时加载一个子场景。
///
- public SceneHandle LoadSceneAsync(AssetInfo assetInfo, LoadSceneMode sceneMode, bool suspendLoad, uint priority, LocalPhysicsMode physicsMode = default)
+ public SceneHandle LoadSceneAsync(AssetInfo assetInfo, LoadSceneParameters loadSceneParams, bool suspendLoad, uint priority)
{
if (assetInfo.IsInvalid)
{
@@ -97,7 +97,7 @@ namespace YooAsset
}
// 如果加载的是主场景,则卸载所有缓存的场景
- if (sceneMode == LoadSceneMode.Single)
+ if (loadSceneParams.loadSceneMode == LoadSceneMode.Single)
{
UnloadAllScene();
}
@@ -107,9 +107,9 @@ namespace YooAsset
ProviderOperation provider;
{
if (_simulationOnEditor)
- provider = new DatabaseSceneProvider(this, providerGUID, assetInfo, sceneMode, suspendLoad, physicsMode);
+ provider = new DatabaseSceneProvider(this, providerGUID, assetInfo, loadSceneParams, suspendLoad);
else
- provider = new BundledSceneProvider(this, providerGUID, assetInfo, sceneMode, suspendLoad, physicsMode);
+ provider = new BundledSceneProvider(this, providerGUID, assetInfo, loadSceneParams, suspendLoad);
provider.InitSpawnDebugInfo();
_providerDic.Add(providerGUID, provider);
OperationSystem.StartOperation(PackageName, provider);
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs b/Assets/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs
index 72f052f..08e1bec 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs
@@ -486,11 +486,11 @@ namespace YooAsset
///
/// 场景的定位地址
/// 场景加载模式
- public SceneHandle LoadSceneSync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, LocalPhysicsMode physicsMode = default)
+ public SceneHandle LoadSceneSync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, LocalPhysicsMode physicsMode = LocalPhysicsMode.None)
{
DebugCheckInitialize();
AssetInfo assetInfo = ConvertLocationToAssetInfo(location, null);
- return LoadSceneInternal(assetInfo, true, sceneMode, false, 0, physicsMode);
+ return LoadSceneInternal(assetInfo, true, sceneMode, physicsMode, false, 0);
}
///
@@ -498,10 +498,10 @@ namespace YooAsset
///
/// 场景的资源信息
/// 场景加载模式
- public SceneHandle LoadSceneSync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, LocalPhysicsMode physicsMode = default)
+ public SceneHandle LoadSceneSync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, LocalPhysicsMode physicsMode = LocalPhysicsMode.None)
{
DebugCheckInitialize();
- return LoadSceneInternal(assetInfo, true, sceneMode, false, 0, physicsMode);
+ return LoadSceneInternal(assetInfo, true, sceneMode, physicsMode, false, 0);
}
///
@@ -511,11 +511,11 @@ namespace YooAsset
/// 场景加载模式
/// 场景加载到90%自动挂起
/// 加载的优先级
- public SceneHandle LoadSceneAsync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, bool suspendLoad = false, uint priority = 0, LocalPhysicsMode physicsMode = default)
+ public SceneHandle LoadSceneAsync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, LocalPhysicsMode physicsMode = LocalPhysicsMode.None, bool suspendLoad = false, uint priority = 0)
{
DebugCheckInitialize();
AssetInfo assetInfo = ConvertLocationToAssetInfo(location, null);
- return LoadSceneInternal(assetInfo, false, sceneMode, suspendLoad, priority, physicsMode);
+ return LoadSceneInternal(assetInfo, false, sceneMode, physicsMode, suspendLoad, priority);
}
///
@@ -525,16 +525,17 @@ namespace YooAsset
/// 场景加载模式
/// 场景加载到90%自动挂起
/// 加载的优先级
- public SceneHandle LoadSceneAsync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, bool suspendLoad = false, uint priority = 0, LocalPhysicsMode physicsMode = default)
+ public SceneHandle LoadSceneAsync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, LocalPhysicsMode physicsMode = LocalPhysicsMode.None, bool suspendLoad = false, uint priority = 0)
{
DebugCheckInitialize();
- return LoadSceneInternal(assetInfo, false, sceneMode, suspendLoad, priority, physicsMode);
+ return LoadSceneInternal(assetInfo, false, sceneMode, physicsMode, suspendLoad, priority);
}
- private SceneHandle LoadSceneInternal(AssetInfo assetInfo, bool waitForAsyncComplete, LoadSceneMode sceneMode, bool suspendLoad, uint priority, LocalPhysicsMode physicsMode = default)
+ private SceneHandle LoadSceneInternal(AssetInfo assetInfo, bool waitForAsyncComplete, LoadSceneMode sceneMode, LocalPhysicsMode physicsMode, bool suspendLoad, uint priority)
{
DebugCheckAssetLoadType(assetInfo.AssetType);
- var handle = _resourceManager.LoadSceneAsync(assetInfo, sceneMode, suspendLoad, priority, physicsMode);
+ var loadSceneParams = new LoadSceneParameters(sceneMode, physicsMode);
+ var handle = _resourceManager.LoadSceneAsync(assetInfo, loadSceneParams, suspendLoad, priority);
if (waitForAsyncComplete)
handle.WaitForAsyncComplete();
return handle;
diff --git a/Assets/YooAsset/Runtime/YooAssetsExtension.cs b/Assets/YooAsset/Runtime/YooAssetsExtension.cs
index 533df04..731e6cf 100644
--- a/Assets/YooAsset/Runtime/YooAssetsExtension.cs
+++ b/Assets/YooAsset/Runtime/YooAssetsExtension.cs
@@ -161,7 +161,7 @@ namespace YooAsset
///
/// 场景的定位地址
/// 场景加载模式
- public static SceneHandle LoadSceneSync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, LocalPhysicsMode physicsMode = default)
+ public static SceneHandle LoadSceneSync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, LocalPhysicsMode physicsMode = LocalPhysicsMode.None)
{
DebugCheckDefaultPackageValid();
return _defaultPackage.LoadSceneSync(location, sceneMode, physicsMode);
@@ -172,7 +172,7 @@ namespace YooAsset
///
/// 场景的资源信息
/// 场景加载模式
- public static SceneHandle LoadSceneSync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, LocalPhysicsMode physicsMode = default)
+ public static SceneHandle LoadSceneSync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, LocalPhysicsMode physicsMode = LocalPhysicsMode.None)
{
DebugCheckDefaultPackageValid();
return _defaultPackage.LoadSceneSync(assetInfo, sceneMode, physicsMode);
@@ -185,10 +185,10 @@ namespace YooAsset
/// 场景加载模式
/// 场景加载到90%自动挂起
/// 优先级
- public static SceneHandle LoadSceneAsync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, bool suspendLoad = false, uint priority = 100, LocalPhysicsMode physicsMode = default)
+ public static SceneHandle LoadSceneAsync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, LocalPhysicsMode physicsMode = LocalPhysicsMode.None, bool suspendLoad = false, uint priority = 100)
{
DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadSceneAsync(location, sceneMode, suspendLoad, priority, physicsMode);
+ return _defaultPackage.LoadSceneAsync(location, sceneMode, physicsMode, suspendLoad, priority);
}
///
@@ -198,10 +198,10 @@ namespace YooAsset
/// 场景加载模式
/// 场景加载到90%自动挂起
/// 优先级
- public static SceneHandle LoadSceneAsync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, bool suspendLoad = false, uint priority = 100, LocalPhysicsMode physicsMode = default)
+ public static SceneHandle LoadSceneAsync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, LocalPhysicsMode physicsMode = LocalPhysicsMode.None, bool suspendLoad = false, uint priority = 100)
{
DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadSceneAsync(assetInfo, sceneMode, suspendLoad, priority, physicsMode);
+ return _defaultPackage.LoadSceneAsync(assetInfo, sceneMode, physicsMode, suspendLoad, priority);
}
#endregion