diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearAllBundleFilesOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearAllBundleFilesOperation.cs index e332ab9..3a06b68 100644 --- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearAllBundleFilesOperation.cs +++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearAllBundleFilesOperation.cs @@ -45,6 +45,12 @@ namespace YooAsset if (_steps == ESteps.ClearFileSystemA) { + if (_fileSystemA == null) + { + _steps = ESteps.ClearFileSystemB; + return; + } + if (_clearAllBundleFilesOpA == null) _clearAllBundleFilesOpA = _fileSystemA.ClearAllBundleFilesAsync(); diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearUnusedBundleFilesOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearUnusedBundleFilesOperation.cs index f7862d0..10e7782 100644 --- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearUnusedBundleFilesOperation.cs +++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearUnusedBundleFilesOperation.cs @@ -45,6 +45,12 @@ namespace YooAsset if (_steps == ESteps.ClearFileSystemA) { + if (_fileSystemA == null) + { + _steps = ESteps.ClearFileSystemB; + return; + } + if (_clearUnusedBundleFilesOpA == null) _clearUnusedBundleFilesOpA = _fileSystemA.ClearUnusedBundleFilesAsync(_impl.ActiveManifest); diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/InitializationOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/InitializationOperation.cs index 22cc9b2..c69752f 100644 --- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/InitializationOperation.cs +++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/InitializationOperation.cs @@ -201,14 +201,6 @@ namespace YooAsset if (_steps == ESteps.CreateFileSystem) { - if (_parameters.BuildinFileSystemParameters == null) - { - _steps = ESteps.Done; - Status = EOperationStatus.Failed; - Error = "Buildin file system parameters is null"; - return; - } - if (_parameters.CacheFileSystemParameters == null) { _steps = ESteps.Done; @@ -217,6 +209,19 @@ namespace YooAsset return; } + if (_parameters.BuildinFileSystemParameters != null) + { + _impl.BuildinFileSystem = PlayModeHelper.CreateFileSystem(_impl.PackageName, _parameters.BuildinFileSystemParameters); + if (_impl.BuildinFileSystem == null) + { + _steps = ESteps.Done; + Status = EOperationStatus.Failed; + Error = "Failed to create buildin file system"; + return; + } + return; + } + if (_parameters.DeliveryFileSystemParameters != null) { _impl.DeliveryFileSystem = PlayModeHelper.CreateFileSystem(_impl.PackageName, _parameters.DeliveryFileSystemParameters); @@ -229,15 +234,6 @@ namespace YooAsset } } - _impl.BuildinFileSystem = PlayModeHelper.CreateFileSystem(_impl.PackageName, _parameters.BuildinFileSystemParameters); - if (_impl.BuildinFileSystem == null) - { - _steps = ESteps.Done; - Status = EOperationStatus.Failed; - Error = "Failed to create buildin file system"; - return; - } - _impl.CacheFileSystem = PlayModeHelper.CreateFileSystem(_impl.PackageName, _parameters.CacheFileSystemParameters); if (_impl.CacheFileSystem == null) { @@ -252,6 +248,13 @@ namespace YooAsset if (_steps == ESteps.InitBuildinFileSystem) { + // 注意:内置文件系统可以为空 + if (_impl.BuildinFileSystem == null) + { + _steps = ESteps.InitDeliveryFileSystem; + return; + } + if (_initBuildinFileSystemOp == null) _initBuildinFileSystemOp = _impl.BuildinFileSystem.InitializeFileSystemAsync(); diff --git a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/HostPlayModeImpl.cs b/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/HostPlayModeImpl.cs index 4344371..4daf812 100644 --- a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/HostPlayModeImpl.cs +++ b/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/HostPlayModeImpl.cs @@ -7,7 +7,7 @@ namespace YooAsset internal class HostPlayModeImpl : IPlayMode, IBundleQuery { public readonly string PackageName; - public IFileSystem BuildinFileSystem { set; get; } + public IFileSystem BuildinFileSystem { set; get; } //可以为空! public IFileSystem DeliveryFileSystem { set; get; } //可以为空! public IFileSystem CacheFileSystem { set; get; } @@ -118,7 +118,7 @@ namespace YooAsset if (packageBundle == null) throw new Exception("Should never get here !"); - if (BuildinFileSystem.Belong(packageBundle)) + if (BuildinFileSystem != null && BuildinFileSystem.Belong(packageBundle)) { BundleInfo bundleInfo = new BundleInfo(BuildinFileSystem, packageBundle); return bundleInfo;