KirmesBude / bevy_trickfilm

bevy_trickfilm
Apache License 2.0
6 stars 3 forks source link

Panic in example that uses asset_loader #10

Closed PraxTube closed 9 months ago

PraxTube commented 9 months ago

I get the following panic in the spritesheet_animation_asset_loader example.

assertion `left == right` failed: The target AssetId<bevy_trickfilm::asset::AnimationClip2D>'s TypeId does not match the TypeId of this UntypedAssetId
  left: TypeId { t: 316409549851621916216665674778210318356 }
 right: TypeId { t: 32342782855545586996771850786755671691 }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in exclusive system `bevy_asset::server::handle_internal_asset_events`!
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!

Not sure if I failed to set something up correctly, but the other two examples work just fine.

KirmesBude commented 9 months ago

Yeah, that example is broken with bevy 0.12.0 I think the same is true for just bevy_asset_loader (given the right circumstances). Should be fixed by bevy 0.12.1 (when it releases; works with bevy main at least) Sorry for not documenting that correctly. You should still be able to use this crate with bevy_asset_loader If you load the animations separately or load the whole Animation2DSet (I think the collection(typed) was the Problem)

PraxTube commented 9 months ago

Ah okay yeah that makes sense. I also thought that the collection(typed) was the issue, but the following still gives me the same panic.

#[asset(path = "gabe-idle-run.trickfilm#run")]
run_animation: Handle<AnimationClip2D>,

Not quite sure which AnimationSet2D you mean.

KirmesBude commented 9 months ago

Oh, you are right. Guess the option with AnimationClip2DSet is the only option for now with bevy_asset_loader. I created a branch with this example https://github.com/KirmesBude/bevy_trickfilm/blob/load_animation_set/examples/spritesheet_animation_asset_loader.rs. But as you can see it is noticeably worse to work with.

Edit for some additional explanation: The trickfilm file always specifies a AnimationClip2DSet, but it also contains "labeled assets" (that is what you can put after the hashtag) which will pull only that AnimationClip2D out of the asset.

PraxTube commented 9 months ago

Ah okay nice, thanks! Yeah it is less elegant, but if it's going to be fixed in bevy 12.1 then it's alright. Also thanks for the explanation, that's helpful to know :)

KirmesBude commented 9 months ago

I will leave the issue open until bevy 0.12.1 has been released. If you encounter any other problems (bugs or workflow) or have any suggestions, let me know :).

PraxTube commented 9 months ago

Seems reasonable, will do :+1:

KirmesBude commented 9 months ago

bevy 0.12.1 came sooner than expected. Looks like the issue is fixed.