AppStartup.cs 642 B

12345678910111213141516171819
  1. using System;
  2. using Cysharp.Threading.Tasks;
  3. using HotPatch;
  4. using UnityEngine;
  5. using UnityEngine.Events;
  6. public sealed class AppStartup : MonoBehaviour
  7. {
  8. public UnityEvent onPatchReady;
  9. void Start() => LoadAsync().Forget(Debug.LogException);
  10. async UniTask LoadAsync()
  11. {
  12. await HotPatchService.LoadAndInitializeAsync(
  13. p => Debug.Log($"[HotPatch] {p.Stage}: {p.Value:P0}"), destroyCancellationToken);
  14. onPatchReady?.Invoke();
  15. }
  16. }