CustomUtils Help

DownloadService

구현 코드 바로 가기

  • UnityWebRequest, DownloadHandler기반의 리소스 다운로드 시스템 제공

  • DownloadHandlerModule<TReturn>, IDownloadHandlerModule을 통한 커스텀 DownloadHandler 개발 및 처리 인터페이스 제공

DownloadHandlerModule
  • DownloadHandlerScript, IDownloadHandlerModule 기초 인터페이스 구현 제공

  • DownloadHandlerModule을 통해 UnityWebRequest 생성을 위임

  • GetContent() 구현을 통한 다운로드 결과 통합 처리

IDownloadHandlerModuleUnityWebRequest CreateWebRequest()UnityWebRequest GetWebRequest()«DownloadHandler, UnityNative»DownloadHandlerScriptDownloadHandlerModulestring urlUnityWebRequest webRequestbool TryGetContent(out TReturn content)TReturn GetContent()NewCustomDownloadHandler
private void DownloadJsonFile<T>(string serverPath, Action<Result, T> callback = null) where T : class { Service.GetService<DownloadService>().Download(new JsonDownloadHandler<T>(Path.Combine(config.url, serverPath), _plainEncryptKey), (result, handler) => { using (handler) { if (result == Result.Success) { callback?.Invoke(result, handler.GetContent()); } } }); }
Last modified: 01 2월 2025