-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Adding Entity as child to other entity makes it invisible #5081
Copy link
Copy link
Closed
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenA-TransformTranslations, rotations and scalesTranslations, rotations and scalesC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behavior
Description
Bevy version
0.7.0
[Optional] Relevant system information
OS: Arch Linux
Cargo version: cargo 1.63.0-nightly
2022-06-23T15:29:27.512314Z INFO bevy_render::renderer: AdapterInfo { name: "AMD RADV RENOIR", vendor: 4098, device: 5708, device_type: IntegratedGpu, backend: Vulkan }What you did
I tried adding new entities as children to parent entity.
What went wrong
Child entities are invisible, but they still function (as colliders for example).
Additional information
Code that works and renders all entities (only included shortened version for the left wall, but code does the same for all of the walls):
let cell_wall_entity_left = commands
.spawn()
.insert_bundle(
SpriteBundle {
sprite: Sprite {
color: Color::rgb(0.5, 0.5, 0.3),
..default()
},
transform: Transform {
translation: wall_position.extend(0.1),
scale: Vec3::new(40., 5. , 1.),
..default()
},
..default()
},
)
.insert(Collider)
.id();
let parent_cell = commands
.spawn_bundle(CellBundle::new(
SpriteBundle {
sprite: Sprite {
color: cell_type.to_color(),
..default()
},
transform: Transform {
translation: cell_position.extend(0.),
scale: Vec3::new(CELL_SIZE.x, CELL_SIZE.y, 1.0),
..default()
},
..default()
},
Cell::new(),
Collider,
));If I change the last line to:
)).insert(CellType::Cell).push_children(&[cell_wall_entity_left]);Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenA-TransformTranslations, rotations and scalesTranslations, rotations and scalesC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behavior

