fix
This commit is contained in:
@@ -50,12 +50,21 @@ public class ColorbookFlowController : IAsyncStartable, IDisposable
|
||||
public async UniTask StartAsync(CancellationToken cancellation = new CancellationToken())
|
||||
{
|
||||
_scopeCts = CancellationTokenSource.CreateLinkedTokenSource(cancellation);
|
||||
// Grab the token value up front. If the scope is torn down (scene unload) while the
|
||||
// init below is in flight, the await resumes during disposal — when _scopeCts is already
|
||||
// disposed and its .Token getter would throw ObjectDisposedException. The captured struct
|
||||
// stays safe to read.
|
||||
var ct = _scopeCts.Token;
|
||||
_returnToMainMenuSubscription = _bus.Subscribe<ReturnToMainMenuSignal>(OnReturnToMainMenu);
|
||||
_loadingScreen.SetProgress(1f);
|
||||
await _drawingCatalog.InitializeAsync(cancellation);
|
||||
await _drawingCatalog.InitializeAsync(ct);
|
||||
// scope disposed mid-init; nothing left to do. Check the external token too — it's the
|
||||
// one VContainer cancels on teardown, and the linked _scopeCts may lag the callback order.
|
||||
if (cancellation.IsCancellationRequested || ct.IsCancellationRequested) return;
|
||||
|
||||
if (!_navigatingToGameplay) _loadingScreen.Hide();
|
||||
|
||||
PrewarmInterstitialAdAsync(_scopeCts.Token).Forget();
|
||||
PrewarmInterstitialAdAsync(ct).Forget();
|
||||
}
|
||||
|
||||
private async UniTaskVoid PrewarmInterstitialAdAsync(CancellationToken ct)
|
||||
|
||||
Reference in New Issue
Block a user