pub struct LoadingOverlay {
pub screen: Option<AssetId>,
pub backdrop: Option<AssetId>,
pub track: Option<AssetId>,
pub fill: Option<AssetId>,
pub label: Option<AssetId>,
}Expand description
Requests the scene-loading overlay: a full-window backdrop with a progress bar, shown while a scene jump waits for its streamed content and faded out once the destination scene is fully resident.
The overlay is assembled from ordinary UI elements the fields reference: a Screen that hosts them, a backdrop Sprite covering the canvas, a progress-bar track and fill Sprite pair, and a TextLabel above the bar. Each frame the engine widens the fill to the destination scene’s load progress and rewrites the label with the percentage; restyle any piece by declaring it yourself under the same name.
While the overlay’s screen is up the world pauses and its render is skipped, exactly like an opaque menu, but streaming keeps running so the load it reports can finish. Scenes whose content is already resident jump without the overlay ever appearing.
Every rendering world that declares Scenes and a
StreamingConfig receives a LoadingOverlay and its
pieces at build time when it declares none, so the example below is only
needed to restyle them. Declare an EngineDefaults with
"loading_overlay": false to remove it from the build entirely.
Fields§
§screen: Option<AssetId>Screen the overlay shows while a scene loads. Its
pauses_world (on by default) freezes the world beneath the overlay so
the destination scene starts fresh when revealed.
backdrop: Option<AssetId>Backdrop Sprite covering the canvas. Its tint alpha is animated to reveal the scene once loading completes; an opaque tint hides the still-loading world completely.
track: Option<AssetId>Progress-bar track Sprite; its width is the bar’s full extent the fill is measured against.
fill: Option<AssetId>Progress-bar fill Sprite; the engine sets its width to the track width times the destination scene’s load progress each frame.
label: Option<AssetId>TextLabel rewritten each frame with the load percentage.
Trait Implementations§
Source§impl Clone for LoadingOverlay
impl Clone for LoadingOverlay
Source§fn clone(&self) -> LoadingOverlay
fn clone(&self) -> LoadingOverlay
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Component for LoadingOverlay
impl Component for LoadingOverlay
Source§const NAME: &'static str = "LoadingOverlay"
const NAME: &'static str = "LoadingOverlay"
Source§fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
Source§fn inject_locator(&mut self, _locator: PayloadLocator)
fn inject_locator(&mut self, _locator: PayloadLocator)
Source§fn inject_name(&mut self, _id: AssetId)
fn inject_name(&mut self, _id: AssetId)
Source§impl ComponentSlot for LoadingOverlay
impl ComponentSlot for LoadingOverlay
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
ComponentId.