If I make a world with an entity and make a bundle for that entity type:
#[derive(Bundle, LdtkEntity)]
pub struct PlayerBundle {
player: Player, // Custom component for WASD controls and camera follow
#[bundle]
#[sprite_sheet_bundle]
sprite_bundle: SpriteSheetBundle, // I have a sprite set for it in-editor
}
Though the bundle is instantiated, I can only see the map itself, but not the spawned player entity, no matter what I do - custom sprites in the bundle, etc. change nothing. I can confirm that the entity exists, though, and my player system with simple W/A/S/D controls can move it around while the camera tries to track it. It is set to use an editor visual from the exact same tilesheet that the tiles for the tile layer use.
Something about spawning an LdtkEntity seems to cause it to be invisible - instantiating the exact same bundle from code works perfectly fine?
An edit:
It turns out the TextureAtlasSprite index is being set to zero instead of the correct value as set from LdTk.
This was a silly mistake on my part, I had missed something obvious in my own code that was overwriting the sprite index. My apologies, I thought I had checked/disabled it long before creating this issue.
If I make a world with an entity and make a bundle for that entity type:
register that bundle:
and then in my startup system, add a camera and tilemap:
Though the bundle is instantiated, I can only see the map itself, but not the spawned player entity, no matter what I do - custom sprites in the bundle, etc. change nothing. I can confirm that the entity exists, though, and my player system with simple W/A/S/D controls can move it around while the camera tries to track it. It is set to use an editor visual from the exact same tilesheet that the tiles for the tile layer use.
Something about spawning an LdtkEntity seems to cause it to be invisible - instantiating the exact same bundle from code works perfectly fine?
An edit:
It turns out the TextureAtlasSprite index is being set to zero instead of the correct value as set from LdTk.