Skip to main content

loading_progress_system

Function loading_progress_system 

Source
pub fn loading_progress_system(
    manager: Res<'_, ChunkManager>,
    viewer: Res<'_, ViewerPosition>,
    loading_state: ResMut<'_, WorldLoadingState>,
    progress_writer: MessageWriter<'_, LoadingProgress>,
    ready_writer: MessageWriter<'_, WorldReady>,
    pending_meshes: Option<Res<'_, PendingChunkMeshes>>,
)
Expand description

Tracks initial chunk loading and emits LoadingProgress and WorldReady.

Scheduled in Update, ordered after GeneratorSystems so that any chunks completed in the current frame are already counted before progress is computed.

Each frame it counts the chunks in the load range around the ViewerPosition (the same chunks streaming_system requests) and how many of them are loaded, and stores the first count in WorldLoadingState::expected.

Once WorldLoadingState::ready is true (set after WorldReady fires), the system returns immediately without writing any messages.