diff --git a/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs b/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs index f67b846..9dd0d3c 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs @@ -169,7 +169,7 @@ namespace YooAsset /// /// 加载场景 /// - public SceneOperationHandle LoadSceneAsync(AssetInfo assetInfo, LoadSceneMode sceneMode, bool activateOnLoad, int priority) + public SceneOperationHandle LoadSceneAsync(AssetInfo assetInfo, LoadSceneMode sceneMode, int priority) { if (assetInfo.IsInvalid) { @@ -190,9 +190,9 @@ namespace YooAsset ProviderBase provider; { if (_simulationOnEditor) - provider = new DatabaseSceneProvider(this, providerGUID, assetInfo, sceneMode, activateOnLoad, priority); + provider = new DatabaseSceneProvider(this, providerGUID, assetInfo, sceneMode, priority); else - provider = new BundledSceneProvider(this, providerGUID, assetInfo, sceneMode, activateOnLoad, priority); + provider = new BundledSceneProvider(this, providerGUID, assetInfo, sceneMode, priority); provider.InitSpawnDebugInfo(); _providerList.Add(provider); _providerDic.Add(providerGUID, provider); diff --git a/Assets/YooAsset/Runtime/AssetSystem/Handles/SceneOperationHandle.cs b/Assets/YooAsset/Runtime/AssetSystem/Handles/SceneOperationHandle.cs index 4f15206..b170a08 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Handles/SceneOperationHandle.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Handles/SceneOperationHandle.cs @@ -3,7 +3,7 @@ namespace YooAsset { public class SceneOperationHandle : OperationHandleBase - { + { private System.Action _callback; internal string PackageName { set; get; } @@ -51,7 +51,7 @@ namespace YooAsset } /// - /// 激活场景 + /// 激活场景(当同时存在多个场景时用于切换激活场景) /// public bool ActivateScene() { diff --git a/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledSceneProvider.cs b/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledSceneProvider.cs index b8e4d6b..85ce68b 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledSceneProvider.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledSceneProvider.cs @@ -10,15 +10,13 @@ namespace YooAsset { public readonly LoadSceneMode SceneMode; private readonly string _sceneName; - private readonly bool _activateOnLoad; private readonly int _priority; private AsyncOperation _asyncOp; - public BundledSceneProvider(AssetSystemImpl impl, string providerGUID, AssetInfo assetInfo, LoadSceneMode sceneMode, bool activateOnLoad, int priority) : base(impl, providerGUID, assetInfo) + public BundledSceneProvider(AssetSystemImpl impl, string providerGUID, AssetInfo assetInfo, LoadSceneMode sceneMode, int priority) : base(impl, providerGUID, assetInfo) { SceneMode = sceneMode; _sceneName = Path.GetFileNameWithoutExtension(assetInfo.AssetPath); - _activateOnLoad = activateOnLoad; _priority = priority; } public override void Update() @@ -87,9 +85,6 @@ namespace YooAsset Progress = _asyncOp.progress; if (_asyncOp.isDone) { - if (SceneObject.IsValid() && _activateOnLoad) - SceneManager.SetActiveScene(SceneObject); - Status = SceneObject.IsValid() ? EStatus.Succeed : EStatus.Failed; if (Status == EStatus.Failed) { diff --git a/Assets/YooAsset/Runtime/AssetSystem/Provider/DatabaseSceneProvider.cs b/Assets/YooAsset/Runtime/AssetSystem/Provider/DatabaseSceneProvider.cs index 48b9497..23e2cab 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Provider/DatabaseSceneProvider.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Provider/DatabaseSceneProvider.cs @@ -6,14 +6,12 @@ namespace YooAsset internal sealed class DatabaseSceneProvider : ProviderBase { public readonly LoadSceneMode SceneMode; - private readonly bool _activateOnLoad; private readonly int _priority; private AsyncOperation _asyncOp; - public DatabaseSceneProvider(AssetSystemImpl impl, string providerGUID, AssetInfo assetInfo, LoadSceneMode sceneMode, bool activateOnLoad, int priority) : base(impl, providerGUID, assetInfo) + public DatabaseSceneProvider(AssetSystemImpl impl, string providerGUID, AssetInfo assetInfo, LoadSceneMode sceneMode, int priority) : base(impl, providerGUID, assetInfo) { SceneMode = sceneMode; - _activateOnLoad = activateOnLoad; _priority = priority; } public override void Update() @@ -76,10 +74,7 @@ namespace YooAsset { Progress = _asyncOp.progress; if (_asyncOp.isDone) - { - if (SceneObject.IsValid() && _activateOnLoad) - SceneManager.SetActiveScene(SceneObject); - + { Status = SceneObject.IsValid() ? EStatus.Succeed : EStatus.Failed; if (Status == EStatus.Failed) { diff --git a/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs b/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs index 5fd7a39..3bf370d 100644 --- a/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs +++ b/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs @@ -455,13 +455,12 @@ namespace YooAsset /// /// 场景的定位地址 /// 场景加载模式 - /// 加载完毕时是否主动激活 /// 优先级 - public SceneOperationHandle LoadSceneAsync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, bool activateOnLoad = true, int priority = 100) + public SceneOperationHandle LoadSceneAsync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, int priority = 100) { DebugCheckInitialize(); AssetInfo assetInfo = ConvertLocationToAssetInfo(location, null); - var handle = _assetSystemImpl.LoadSceneAsync(assetInfo, sceneMode, activateOnLoad, priority); + var handle = _assetSystemImpl.LoadSceneAsync(assetInfo, sceneMode, priority); return handle; } @@ -470,12 +469,11 @@ namespace YooAsset /// /// 场景的资源信息 /// 场景加载模式 - /// 加载完毕时是否主动激活 /// 优先级 - public SceneOperationHandle LoadSceneAsync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, bool activateOnLoad = true, int priority = 100) + public SceneOperationHandle LoadSceneAsync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, int priority = 100) { DebugCheckInitialize(); - var handle = _assetSystemImpl.LoadSceneAsync(assetInfo, sceneMode, activateOnLoad, priority); + var handle = _assetSystemImpl.LoadSceneAsync(assetInfo, sceneMode, priority); return handle; } #endregion diff --git a/Assets/YooAsset/Runtime/YooAssetsExtension.cs b/Assets/YooAsset/Runtime/YooAssetsExtension.cs index de45f89..d2a82d4 100644 --- a/Assets/YooAsset/Runtime/YooAssetsExtension.cs +++ b/Assets/YooAsset/Runtime/YooAssetsExtension.cs @@ -128,12 +128,11 @@ namespace YooAsset /// /// 场景的定位地址 /// 场景加载模式 - /// 加载完毕时是否主动激活 /// 优先级 - public static SceneOperationHandle LoadSceneAsync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, bool activateOnLoad = true, int priority = 100) + public static SceneOperationHandle LoadSceneAsync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, int priority = 100) { DebugCheckDefaultPackageValid(); - return _defaultPackage.LoadSceneAsync(location, sceneMode, activateOnLoad, priority); + return _defaultPackage.LoadSceneAsync(location, sceneMode, priority); } /// @@ -141,12 +140,11 @@ namespace YooAsset /// /// 场景的资源信息 /// 场景加载模式 - /// 加载完毕时是否主动激活 /// 优先级 - public static SceneOperationHandle LoadSceneAsync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, bool activateOnLoad = true, int priority = 100) + public static SceneOperationHandle LoadSceneAsync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, int priority = 100) { DebugCheckDefaultPackageValid(); - return _defaultPackage.LoadSceneAsync(assetInfo, sceneMode, activateOnLoad, priority); + return _defaultPackage.LoadSceneAsync(assetInfo, sceneMode, priority); } #endregion