diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs index b14c1cfb..cc78c4f0 100644 --- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs +++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs @@ -75,6 +75,11 @@ namespace YooAsset /// public bool AppendFileExtension { private set; get; } = false; + /// + /// 自定义参数:禁用边玩边下机制 + /// + public bool DisableOnDemandDownload { private set; get; } = false; + /// /// 自定义参数:最大并发连接数 /// @@ -222,6 +227,10 @@ namespace YooAsset { AppendFileExtension = Convert.ToBoolean(value); } + else if (name == FileSystemParametersDefine.DISABLE_ONDEMAND_DOWNLOAD) + { + DisableOnDemandDownload = Convert.ToBoolean(value); + } else if (name == FileSystemParametersDefine.DOWNLOAD_MAX_CONCURRENCY) { DownloadMaxConcurrency = Convert.ToInt32(value); diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs index 9111ec86..a9396686 100644 --- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs +++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs @@ -49,7 +49,17 @@ namespace YooAsset } else { - _steps = ESteps.DownloadFile; + if (_fileSystem.DisableOnDemandDownload) + { + _steps = ESteps.Done; + Status = EOperationStatus.Failed; + Error = $"The bundle not cached : {_bundle.BundleName}"; + YooLogger.Warning(Error); + } + else + { + _steps = ESteps.DownloadFile; + } } } diff --git a/Assets/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs b/Assets/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs index d9fc543b..2e987d05 100644 --- a/Assets/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs +++ b/Assets/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs @@ -11,6 +11,7 @@ namespace YooAsset public const string APPEND_FILE_EXTENSION = "APPEND_FILE_EXTENSION"; public const string DISABLE_CATALOG_FILE = "DISABLE_CATALOG_FILE"; public const string DISABLE_UNITY_WEB_CACHE = "DISABLE_UNITY_WEB_CACHE"; + public const string DISABLE_ONDEMAND_DOWNLOAD = "DISABLE_ONDEMAND_DOWNLOAD "; public const string DOWNLOAD_MAX_CONCURRENCY = "DOWNLOAD_MAX_CONCURRENCY"; public const string DOWNLOAD_MAX_REQUEST_PER_FRAME = "DOWNLOAD_MAX_REQUEST_PER_FRAME"; public const string RESUME_DOWNLOAD_MINMUM_SIZE = "RESUME_DOWNLOAD_MINMUM_SIZE";