Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix levels having incorrect GlobalTransform the first frame #140

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ mod plugin {
/// As a result, you can expect minimal frame delay when updating these in
/// [CoreStage::Update].
ProcessApi,
SpawnLevelsStage,
}

/// Adds the default systems, assets, and resources used by `bevy_ecs_ldtk`.
Expand All @@ -167,6 +168,11 @@ mod plugin {
LdtkStage::ProcessApi,
SystemStage::parallel(),
)
.add_stage_after(
LdtkStage::ProcessApi,
LdtkStage::SpawnLevelsStage,
SystemStage::parallel(),
)
.init_non_send_resource::<app::LdtkEntityMap>()
.init_non_send_resource::<app::LdtkIntCellMap>()
.init_resource::<resources::LdtkSettings>()
Expand All @@ -176,11 +182,13 @@ mod plugin {
.init_asset_loader::<assets::LdtkLevelLoader>()
.add_event::<resources::LevelEvent>()
.add_system_to_stage(
CoreStage::PreUpdate,
LdtkStage::SpawnLevelsStage,
systems::process_ldtk_assets.label(LdtkSystemLabel::ProcessAssets),
)
.add_system_to_stage(
CoreStage::PreUpdate,
// levels need to be spawned before PostUpdate, so that transforms will
// have time to propagate before the next update
LdtkStage::SpawnLevelsStage,
systems::process_ldtk_levels.label(LdtkSystemLabel::LevelSpawning),
)
.add_system_to_stage(
Expand Down