Decision Guide: Asset Loading Strategy
Decision Guide: Asset Loading Strategy
When to load + waitFor
Use for required startup assets.
Pattern:
handle = cache.load(id)await cache.waitFor(handle)- fail fast if missing
When to Use Lazy load + get
Use for optional assets or progressive loading.
Pattern:
- request handle now
- check
get()each frame - render fallback until available
When to reload
Use for live-edit pipelines and hot-reload workflows.
Important: old handles invalidate after version bump.
When to unload
Use for scene transitions or memory pressure.
Ensure no consumers depend on stale handles.
Dependency Recommendations
- Atlas/metadata loaders should declare texture dependencies.
- Keep asset ids normalized and relative.
- Use extension-specific loaders; avoid catch-all parsing.
Error Handling
- Wrap
waitForin try/catch. - Log and surface failing asset ids.
- Provide fallback assets for non-critical paths.