Skip to content

Loading assets while loading assets? #3940

Answered by mockersf
sdfgeoff asked this question in Q&A
Discussion options

You must be logged in to vote

It's possible, but not very obvious. here is an example.

// Create an asset path to the asset you want loaded
let asset_path = AssetPath::new_ref(path, None);
// Get an handle to the asset at asset_path
let handle = load_context.get_handle(asset_path.clone());

// Use the handle how you want, load other stuff, ...

// Create your loaded asset. mark it as a dependency
let asset = LoadedAsset::new(CustomAsset { .. }).with_dependency(asset_path);

// Set your complete asset as the default one
load_context.set_default_asset(asset);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@sdfgeoff
Comment options

Answer selected by sdfgeoff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants