-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Adding just a Node
component to an empty entity causes a panic
#9615
Comments
Can confirm this harness will reproduce this behaviour on the use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn((
SpatialBundle::default(),
Node::default(),
));
} Looks like the This indicates that the Modifying my test to add a default use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn((
SpatialBundle::default(),
Node::default(),
Style::default(),
));
} My question for someone more familiar with Bevy's UI system would then be: is it intended that a |
You are supposed to use |
Ideally yes. Users might want to write their own layout system but use Bevy UI's rendering. |
A panic also happens when spawning an entity without |
@SludgePhD the specific issue of panicking on non-UI child of UI should be fixed by #9621 |
This seems like it ought to be allowed to me. The UI system can set the entity's style to |
# Objective - Fixes bevyengine#10826 - Fixes bevyengine#9615 ## Solution - Early-out when components are missing.
Bevy version
0.11
What you did
Spawned an entity with a
SpatialBundle
and added aNode
component to it.What went wrong
Since this can easily be done from an editor or a script, this shouldn't cause a crash, but it caused a panic inside bevy:
The text was updated successfully, but these errors were encountered: