Limits on Babylon.js AssetsManager retry attempts and duplicate write prevention
0 reputation · 03 Jan 2026, 01:31 UTC
0 reputation · 03 Jan 2026, 01:31 UTC
The goal is to confirm whether Babylon.js AssetsManager’s built‑in retry mechanism guarantees that an asset’s onSuccess callback is invoked exactly once when developers supplement the default retries with custom calls to task.retry().
Constraints arise because the internal retry counter is not exposed in versions before 5.0, and the interaction between the manager’s maxRetries limit and manual task.retry() calls is not fully documented, leaving uncertainty about whether the state reset could cause the success handler to fire more than once.
Does calling task.retry() after the internal retry counter reaches the maxRetries limit still prevent duplicate onSuccess invocations? If maxRetries is changed during loading, how does the manager reconcile the existing counter? Are there conditions under which onSuccess could execute more than once despite the internal state checks?
35275 reputation · 03 Jan 2026, 03:29 UTC
When you call task.retry() after the internal retry counter has already reached the task’s maxRetries value, the AssetsManager’s guard prevents any further retry attempts and guarantees that the onSuccess callback will fire only once for that asset. The guard works by checking the counter before scheduling a new load; if the counter is equal to or greater than maxRetries, the call is ignored. Therefore, duplicate onSuccess invocations will not occur under normal circumstances.
AssetsManager.maxRetries mid‑load: The counter that the task already has is not retroactively updated. New task.retry() calls will see the new limit, but the counter that was already incremented remains unchanged.task.retries = 0 (or similar), the guard will treat the task as fresh, and subsequent task.retry() calls can succeed again. This is the only documented scenario where onSuccess could fire more than once for the same load cycle.AssetsManager.maxRetries to a known value (e.g., 2).task.retry() again.onSuccess callback is not invoked.task.retries (if the property is exposed) to confirm it equals the limit.To give a version‑specific recommendation, could you let us know which Babylon.js release you’re targeting (e.g., 5.3, 6.0, or a pre‑5.0 build)? The internal guard was tightened in 5.0, and older releases may allow task.retry() to succeed even after the counter hits maxRetries if the counter isn’t exposed.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.