bevy icon indicating copy to clipboard operation
bevy copied to clipboard

scene.rs example crashes

Open gabriel-gheorghe opened this issue 3 years ago • 7 comments

Bevy version

Bevy 0.6.1

Operating system & version

Windows 10

What you did

Run examples/scene/scene.rs

What actually happened

thread 'main' panicked at 'scene contains the unregistered type scene::ComponentB. consider registering the type using app.register_type::<T>()' file src\scene_spawner.rs:333:35

gabriel-gheorghe avatar Feb 18 '22 23:02 gabriel-gheorghe

I was going to look into this, but the example is running fine for me. I'm running Win 11, but not sure that'd make much of a difference.

tyleranton avatar Feb 21 '22 01:02 tyleranton

Could you describe the exact steps you took to run this.

Did you simply clone the repository with the main branch and then ran cargo run --example scene?

IceSentry avatar Mar 03 '22 04:03 IceSentry

Hey guys, I can reproduce this as well on Windows 10.

On a clean project with only the bevy dependency (0.6.1), copy the example code to the main.rs, also add the assets folder. Running cargo run results in the error.

I have no idea sure why, but if I copy the same file to examples/scene.rs of this clean project and run cargo run --example scene it works.

I tried both nightly and stable toolchain.

rika avatar Apr 05 '22 22:04 rika

This is normal if you copy the code somewhere else. In the scene, ComponentB has been serialised as scene::ComponentB, so the struct must be declared under a root binary named scene https://github.com/bevyengine/bevy/blob/30878e3a7db29a244228d9540f4101f36a9e4ff5/assets/scenes/load_scene_example.scn.ron#L23

mockersf avatar Apr 05 '22 22:04 mockersf

Oh I didn't know that, was just testing the scene example to try to learn from it. Thanks for the info @mockersf !

@themilkybit maybe your issue is the same misunderstanding?

rika avatar Apr 05 '22 22:04 rika

Still broken on main (69760c78cff87f2a106ea6bbb5a810e994e453dc):

2024-01-13T14:53:16.822805Z ERROR bevy_asset::server: Failed to load asset 'scenes/load_scene_example.scn.ron' with asset loader 'bevy_scene::scene_loader::SceneLoader': Could not parse RON: 8:6: The given id is not a valid entity.

But this is likely due to e6a324a11a419b5bcd4922ed7039a0f9e7c1abc8 I think. FYI @Bluefinger

torsteingrindvik avatar Jan 13 '24 14:01 torsteingrindvik

Still broken on main (69760c7):

2024-01-13T14:53:16.822805Z ERROR bevy_asset::server: Failed to load asset 'scenes/load_scene_example.scn.ron' with asset loader 'bevy_scene::scene_loader::SceneLoader': Could not parse RON: 8:6: The given id is not a valid entity.

But this is likely due to e6a324a I think. FYI @Bluefinger

This is also to do with #9907 as now the Entity format has changed so that 0 is an invalid u64 value to deserialize an Entity from. This current fix is here https://github.com/bevyengine/bevy/pull/11289

Bluefinger avatar Jan 13 '24 15:01 Bluefinger

Closed by https://github.com/bevyengine/bevy/pull/11289

janhohenheim avatar Jun 29 '24 10:06 janhohenheim