fix bug class run before addressable remote
This commit is contained in:
@@ -99,7 +99,19 @@ namespace BrewMonster.Scripts
|
||||
}
|
||||
|
||||
Debug.Log("[Cuong] AddressableManager: Bootstrap gate xong — đang InitializeAsync Addressables...");
|
||||
Addressables.InitializeAsync().Completed += OnInitializeComplete;
|
||||
try
|
||||
{
|
||||
await AddressablesInitService.EnsureInitializedAsync();
|
||||
_isInitialized = true;
|
||||
_initializationTcs.TrySetResult();
|
||||
BMLogger.Log("AddressableManager: Initialized");
|
||||
Debug.Log("[Cuong] AddressableManager: InitializeAsync xong — sẵn sàng load asset.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
BMLogger.LogError($"AddressableManager: Failed to initialize: {e.Message}");
|
||||
Debug.LogError($"[Cuong] AddressableManager: InitializeAsync thất bại — {e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
async UniTask<bool> WaitForBootstrapGateWithTimeoutAsync()
|
||||
@@ -142,23 +154,6 @@ namespace BrewMonster.Scripts
|
||||
#endregion
|
||||
|
||||
#region private functions
|
||||
private void OnInitializeComplete(AsyncOperationHandle<IResourceLocator> handle)
|
||||
{
|
||||
if (handle.Status == AsyncOperationStatus.Succeeded)
|
||||
{
|
||||
_isInitialized = true;
|
||||
_initializationTcs.TrySetResult();
|
||||
BMLogger.Log($"AddressableManager: Initialized");
|
||||
Debug.Log("[Cuong] AddressableManager: InitializeAsync xong — sẵn sàng load asset.");
|
||||
}
|
||||
else
|
||||
{
|
||||
// print out the error
|
||||
BMLogger.LogError($"AddressableManager: Failed to initialize: {handle.OperationException?.Message} {handle.OperationException?.StackTrace}");
|
||||
Debug.LogError($"[Cuong] AddressableManager: InitializeAsync thất bại — {handle.OperationException?.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveFromReleaseAssetDictionary(string assetPath)
|
||||
{
|
||||
if (_releaseAssetTimestamps.ContainsKey(assetPath))
|
||||
|
||||
Reference in New Issue
Block a user