diff --git a/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystem.cs b/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystem.cs index ec62407..9459c41 100644 --- a/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystem.cs +++ b/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystem.cs @@ -2,6 +2,7 @@ using System.IO; using System.Collections; using System.Collections.Generic; +using UnityEngine.Networking; namespace YooAsset { @@ -15,6 +16,12 @@ namespace YooAsset private static readonly Dictionary _downloaderDic = new Dictionary(); private static readonly List _removeList = new List(100); + + /// + /// 自定义的证书认证实例 + /// + public static CertificateHandler CertificateHandlerInstance; + /// /// 启用断点续传功能文件的最小字节数 /// diff --git a/Assets/YooAsset/Runtime/DownloadSystem/Downloader/FileDownloader.cs b/Assets/YooAsset/Runtime/DownloadSystem/Downloader/FileDownloader.cs index 4c0ae44..30c2967 100644 --- a/Assets/YooAsset/Runtime/DownloadSystem/Downloader/FileDownloader.cs +++ b/Assets/YooAsset/Runtime/DownloadSystem/Downloader/FileDownloader.cs @@ -89,6 +89,12 @@ namespace YooAsset _downloadHandle = handler; #endif + if (DownloadSystem.CertificateHandlerInstance != null) + { + _webRequest.certificateHandler = DownloadSystem.CertificateHandlerInstance; + _webRequest.disposeCertificateHandlerOnDispose = false; + } + _webRequest.downloadHandler = handler; _webRequest.disposeDownloadHandlerOnDispose = true; if (fileLength > 0) diff --git a/Assets/YooAsset/Runtime/YooAssets.cs b/Assets/YooAsset/Runtime/YooAssets.cs index 3f68b89..e9b376e 100644 --- a/Assets/YooAsset/Runtime/YooAssets.cs +++ b/Assets/YooAsset/Runtime/YooAssets.cs @@ -161,7 +161,16 @@ namespace YooAsset { DownloadSystem.ClearFileResponseCodes = codes; } - + + /// + /// 设置下载系统参数,自定义的证书认证实例 + /// + /// + public static void SetDownloadSystemCertificateHandler(UnityEngine.Networking.CertificateHandler instance) + { + DownloadSystem.CertificateHandlerInstance = instance; + } + /// /// 设置异步系统参数,每帧执行消耗的最大时间切片(单位:毫秒) ///