Skip to main content

loading_context

Function loading_context 

Source
pub fn loading_context<R>(
    world: &World,
    source: &str,
    scope: Scope,
    f: impl FnOnce(ReflectContext<'_>) -> R,
) -> R
Expand description

Runs f with a ReflectContext for source that reads the engine’s components too: as reflect_context, with the AssetServer to load each handle read in scope (ReflectContext::loading). For spawning prefabs and a level’s entities (PrefabLibrary).

§Panics

If world has no AssetServer (every App’s has one), or one of the resources is borrowed elsewhere.