When I do this, the sprites are invisible. If I remove the push children they are visible
fn spawn_map(mut commands: Commands, tilemap: Res<TileMap>) {
let mut tiles = Vec::new();
for x in 0..10 {
for y in 0..10 {
let tile = Tiles::WallUp;
tiles.push(
commands
.spawn((
Tile,
Name::new(format!("Tile({x}, {y})")),
tilemap.create_sprite(SpawnSpriteOption {
index: tile.sprite(),
size: Vec2::splat(32.0),
position: Vec3::new(x as f32 * 32.0, y as f32 * 32.0, 0.0),
}),
))
.id(),
);
}
}
commands
.spawn((
Map,
Name::new("Map"),
Transform::default(),
GlobalTransform::default(),
ComputedVisibility::default(),
))
.push_children(&tiles);
}