playcanvas / playcanvas/engine

AssetListLoader should load dependencies for all asset types

Open
#7,345 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: assets enhancement
Dominant language
JavaScript
Stars
16.8k
Forks
2k
Avg merge
4h 32m
Merged PRs (30d)
222

Description

Currently AssetListLoader is only loading dependencies of asset type model.

https://github.com/playcanvas/engine/blob/c5ee86946dc18acda9deaadf07ac50288f6e5a1c/src/framework/asset/asset-list-loader.js#L144-L153

https://github.com/playcanvas/engine/blob/c5ee86946dc18acda9deaadf07ac50288f6e5a1c/src/framework/asset/asset-list-loader.js#L112-L114

My use case:
When switching between scenes I want to use the AssetListLoader to preload all assets and show a progress bar.

I parse the scene and create a list of all assets which need to be loaded.

Let's say the scene contains a render component. When loading the render component the glb won't be loaded with it.
This results in pop in, when changing the scene.

There are multiple asset types, where this problem occurs:

Asset Type Missing dependencies
cubemap textures
material textures
render glb
... ...

There are 2 solutions to this problem:

  1. Handle loading of dependencies in AssetListLoader (similar to model asset type)
  2. Handle loading in AssetRegistry.load. (When a asset is loaded, always load it's dependencies)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read src/framework/asset/asset-list-loader.js at the linked lines and compare its current model dependency handling with src/framework/asset/asset-registry.js around line 388. Trace how cubemap, material, and render assets are loaded, then determine which approach ensures their listed dependencies are loaded before the asset-list progress completes and prevents scene-switching pop-in.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.