#ecs_tilemap / ldtk entity missing component for animation?

12 messages · Page 1 of 1 (latest)

vague canopy
#

you should probly post more code, like the bundles that add TileTextureIndex etc.

#

have you checked the query itself is actually empty?

#

asking just cause the dbg log is nested, so the deserilization could have failed

thorn leaf
# vague canopy have you checked the query itself is actually empty?

I'm pretty sure it's empty: fn process_map( mut commands: Commands, tilemeta: Query<(&Transform, &TileMetadata, Entity, &TileTextureIndex), Added<TileMetadata>>, ) { for (transform, tile_meta, entity, _) in tilemeta.iter() { dbg!(tile_meta); } } is empty, and populates when &TileTextureIndex is exluded.

thorn leaf
# vague canopy you should probly post more code, like the bundles that add `TileTextureIndex` e...

I'm doing a fairly basic bevy_ecs_ldtk setup otherwise as: ```
impl Plugin for Map {
fn build(&self, app: &mut bevy::prelude::App) {
app.add_systems(OnEnter(AppStates::Setup), setup);

            app.insert_resource(LevelSelection::index(0));

            app.add_systems(Update, process_map.run_if(in_state(AppStates::Setup)));
    }

}

pub fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
let map_handle: Handle<LdtkProject> = asset_server.load("maps/beach_0.ldtk");

    commands.spawn(LdtkWorldBundle {
            ldtk_handle: map_handle,
            ..Default::default()
    });

}```

thorn leaf
vague canopy
#

and how/when r u adding TileTextureIndex?

thorn leaf
vague canopy
#

my bad, I thought that was yr component

#

in that case, have u tried running it without the added filter in case there're some ordering issues?

fn process_map(
        mut commands: Commands,
        tilemeta: Query<(&Transform, &TileMetadata, Entity, &TileTextureIndex)>,
) {
        for (transform, tile_meta, entity, _) in tilemeta.iter() {
                dbg!(tile_meta);
        }
}
thorn leaf
vague canopy
#

nothing else comes to mind, sorry