-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Seg Fault When Creating Sprite #2661
Comments
If you want to see what I was attempting to build- I was following the tutorial at the following link: |
I don't think anything in that code should segfault... Do you have more details? Could you retry without the // position window
let window = windows.get_primary_mut().unwrap();
window.set_position(IVec2::new(1920, 1080)); |
Sure can, I'll give it a shot. Sorry for the delayed response I've been sick. |
So after implementing the change you suggested, it works on my windows machine, but still segfaults on WSL Ubuntu. As for 'more details', what else do you need from me? use bevy::prelude::*;
const PLAYER_SPRITE: &str = "player_b_01.png";
// entity, component, system, resource
fn main() {
App::build()
.insert_resource(ClearColor(Color::rgb(0.04, 0.04, 0.04)))
.insert_resource(WindowDescriptor {
title: "Rust Invaders!".to_string(),
width: 598.0,
height: 676.0,
..Default::default()
})
.add_plugins(DefaultPlugins)
.add_startup_system(setup.system())
.run();
}
fn setup(mut commands: Commands,
mut materials: ResMut<Assets<ColorMaterial>>,
asset_server: Res<AssetServer>,
) {
// camera
commands.spawn_bundle(OrthographicCameraBundle::new_2d());
// spawn sprite
commands.spawn_bundle(SpriteBundle {
material: materials.add(asset_server.load(PLAYER_SPRITE).into()),
..Default::default()
});
} |
After further testing- it causes a segfault in the line: .add_plugins(DefaultPlugins) |
I don't know if this is a useful error, I commented out the .add_plugins... line from above: |
This is actually because alsa can't find a sound device at the default '0' in WSL2. I'm not entirely sure how to fix this though, as wslg has pulseaudio setup and other apps have no issue playing audio. |
This issue should probably be renamed to: |
Fixed by #2269 |
Bevy version = 0.5
Commit Hash = 9d45353
Operating system & version
Windows 10 build 21390.co_release.210521-1658 , and Ubuntu 20.04 (on WSL2)
What you did
The following code:
What you expected to happen
Create a sprite- display it on the screen in a window.
What actually happened
Segmentation fault immediately
Additional information
Bevy examples now work on windows Machine.
The text was updated successfully, but these errors were encountered: