Skip to content
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

Problem with the Ldtk loader when running from another project #64

Closed
LeCalicot opened this issue Oct 2, 2021 · 3 comments
Closed

Problem with the Ldtk loader when running from another project #64

LeCalicot opened this issue Oct 2, 2021 · 3 comments
Labels
bug Something isn't working compiling-difficulty Issues with compiling Bevy Retrograde

Comments

@LeCalicot
Copy link

LeCalicot commented Oct 2, 2021

Hi,

first, thanks for the great work, it looks promising! I'm new to bevy and rust, thanks for your patience. I was trying to adapt the ldtk map loading for my project and I encountered some issues. I think it's a bug, but not 100% sure.

First, to test it, I ran the actual ldtk_map.rs example from the cloned repo, it works fine. Then, I moved the example to main.rs. It still compiles fine. Then, I also linked to the online crates what I could.

At this point I have:

[package]
...
name = "bevy_retrograde"
...

[features]
default = ['ldtk']
ldtk = ["bevy_retrograde_ldtk"]

[dependencies]
bevy = {version = "0.5", default-features = false}

bevy_retrograde_core = {version = "0.2"}
bevy_retrograde_ldtk = {version = "0.2", optional = true}
bevy_retrograde_macros = {version = "0.2"}
hex = "0.4.3"

[dev-dependencies]
hex = "0.4.3"
rand = "0.8.3"

[profile.dev]
debug = 0
opt-level = 1

that I can run with cargo run. This runs fine. The bevy_retrograde is still loaded from the lib.rs !

Then I copy the exact same code (main.rs and Cargo.toml) to my project. The difference is that the lib.rs is not present, so I add the line:
bevy_retrograde = "0.2"
in the Cargo.toml file.

But somehow running the same code from my project, it still compiles fine, but when running it, it panics:

Finished dev [unoptimized] target(s) in 26.22s Running target/debug/my_projectOct 02 21:25:26.869 WARN bevy_asset::asset_server: noAssetLoaderfound for the following extension: ldtk thread 'Compute Task Pool (4)' panicked at 'Requested resource does not exist: bevy_asset::assets::Assets<bevy_retrograde_ldtk::asset::LdtkMap>', /home/luc/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.5.0/src/system/system_param.rs:244:17 note: run withRUST_BACKTRACE=1 environment variable to display a backtrace thread 'main' panicked at 'task has failed', /home/luc/.cargo/registry/src/github.com-1ecc6299db9ec823/async-task-4.0.3/src/task.rs:368:45

However, if I copy the lib.rs from the repo, it compiles and run fine (all the code is identical, so...yeah, makes sense ^^) if I include the lib:

[lib]
name = "bevy_retrograde"
path = "src/lib.rs"

Am I missing something or is there an issue with loading the ldtk plugin from the crate?

@zicklag
Copy link
Member

zicklag commented Oct 5, 2021

Hey there!

Sorry for the delay, I've been unavailable for the last bit, but I'm going to test this out and see why it's not working as soon as I can. It should be a simple fix, one way or the other.

@zicklag zicklag added bug Something isn't working compiling-difficulty Issues with compiling Bevy Retrograde labels Oct 5, 2021
@zicklag
Copy link
Member

zicklag commented Oct 7, 2021

I think I know what the problem is now. When creating a standalone project, you aren't meant to depend on the individual bevy_retrograde_[something] crates by themselves. You only need to depend on the bevy_retrograde crate. The bevy_retrograde crate is the one responsible for enabling certain Bevy plugins, which is why you are getting the panic.

I created a new project from scratch and created a GitHub gist with the Cargo.toml and main.rs file that I used and it worked fine. Let me know if this doesn't work for you!

https://gist.github.com/zicklag/06f7bd82afa81bc8f45b4e92ab866658

@LeCalicot
Copy link
Author

That did the trick! Thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiling-difficulty Issues with compiling Bevy Retrograde
Projects
None yet
Development

No branches or pull requests

2 participants