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

Support for upcoming release / main branch #189

Closed
miketwenty1 opened this issue Jun 26, 2023 · 12 comments
Closed

Support for upcoming release / main branch #189

miketwenty1 opened this issue Jun 26, 2023 · 12 comments

Comments

@miketwenty1
Copy link

Is there any plans to support 0.11 before it's released? .add_plugin(EguiPlugin) doesn't work with the main branch of bevy currently.

@vladbat00
Copy link
Owner

Hey, there's a fork maintaining the 0.11 support: #188

@miketwenty1
Copy link
Author

@mvlabat @Vrixyz

How would one utilize the Vrixyz fork in Cargo.toml?
I've tried a couple things and I'm getting errors:

bevy_egui = { git = "https://github.com/Vrixyz/bevy_egui", branch = "bevy-main" }

Is there an example Cargo.toml I look at to understand how to properly specify the right dependencies in the right way?

@Vrixyz
Copy link
Contributor

Vrixyz commented Jun 27, 2023

I tested against bevyengine/bevy@cdaae01c.

If you have more dependencies, you might want to patch rather than specifying the dependency directly:

Keep:

bevy_egui = "*"

But add a patch:

[patch.crates-io]
bevy_egui = { git = 'https://github.com/Vrixyz/bevy_egui', branch = 'bevy-main' }

I'll update my fork eventually :)

edit: I updated the fork against bevy as of 10f5c9206847ae01b8dc833c2680562e7bd46664

@miketwenty1
Copy link
Author

@Vrixyz fwiw, I'm getting the same error against bevy's main branch with the modifications you referenced

   Compiling bevy_egui v0.20.3 (https://github.com/Vrixyz/bevy_egui?branch=bevy-main#473ceb60)
error[E0061]: this function takes 2 arguments but 1 argument was supplied
   --> /..../.cargo/git/checkouts/bevy_egui-2b61159b097f520c/473ceb6/src/lib.rs:584:13
    |
584 |             Shader::from_wgsl(include_str!("egui.wgsl")),
                  ^^^^^^^^^^^^^^^^^--------------------------- an argument is missing
[dependencies]
bevy = { git = "https://github.com/bevyengine/bevy", rev = "10f5c9206847ae01b8dc833c2680562e7bd46664" }
bevy_egui = "*"
# other stuff

[patch.crates-io]
bevy_egui = { git = 'https://github.com/Vrixyz/bevy_egui', branch = 'bevy-main' }

[workspace]
resolver = "2"

# Enable a small amount of optimization in debug mode
[profile.dev]
opt-level = 1

# Enable high optimizations for dependencies (incl. Bevy), but not for our code:
[profile.dev.package."*"]
opt-level = 3

@Vrixyz
Copy link
Contributor

Vrixyz commented Jun 27, 2023

Thanks for providing the logs, you're not testing with my latest commit, https://github.com/Vrixyz/bevy_egui?branch=bevy-main#473ceb60 should be https://github.com/Vrixyz/bevy_egui?branch=bevy-main#74c11d35

@Vrixyz
Copy link
Contributor

Vrixyz commented Jun 27, 2023

running cargo update should refresh and pull the latest dependencies

@miketwenty1
Copy link
Author

miketwenty1 commented Jun 27, 2023

@Vrixyz I'm getting a new error when trying to use the plugin.

I tried both the old and new syntax of .add_plugin and .add_plugins. (bevy recently deprecated the .add_plugin it seems)

.add_plugins(EguiPlugin)
error[E0277]: the trait bound `EguiPlugin: bevy_app::plugin::sealed::Plugins<_>` is not satisfied
   --> src/main.rs:106:22
    |
106 |         .add_plugins(EguiPlugin)
    |          ----------- ^^^^^^^^^^ the trait `bevy_app::plugin::sealed::Plugins<_>` is not implemented for `EguiPlugin`
    |          |
    |          required by a bound introduced by this call

Edit: I was using the wrong version of your code, I switched back to the bevy-main branch and I no longer get this error.

Edit2: @Vrixyz
I think Rust Analyzer was playing tricks on me earlier and I got confused.
Do you have an example repo that is able to compile your version of bevy egui that I can learn from?

@Vrixyz
Copy link
Contributor

Vrixyz commented Jun 27, 2023

Sorry I don't have particular example repository for you to study, you can check the updated examples on my branch though.

@miketwenty1
Copy link
Author

@Vrixyz I believe I have some confusion on my end on how this works. I am able to run: cargo run --example ui on your branch.

If I try to take the ui.rs code in examples and run with my own Cargo.toml with main.rs, I'll get errors like this:

error[E0277]: the trait bound `EguiSettings: bevy::prelude::Resource` is not satisfied
   --> src/main.rs:60:24
    |
60  |     mut egui_settings: ResMut<EguiSettings>,
    |                        ^^^^^^^^^^^^^^^^^^^^ the trait `bevy::prelude::Resource` is not implemented for `EguiSettings`

My main.rs is the same as ui.rs in examples.

My Cargo.toml

[package]
name = "testegui"
version = "0.1.0"
edition = "2021"


[dependencies]
bevy = { git = "https://github.com/bevyengine/bevy", rev = "10f5c9206847ae01b8dc833c2680562e7bd46664" } 
bevy_egui = { git = 'https://github.com/Vrixyz/bevy_egui', rev = "74c11d35469d6ee35279b49a773946f7b638e568" } 


[patch.crates-io]

[workspace]
resolver = "2"

[profile.dev]
opt-level = 1

[profile.dev.package."*"]
opt-level = 3

My .cargo/config.toml

[target.wasm32-unknown-unknown]
runner = "wasm-server-runner"

[build]
rustflags = ["--cfg=web_sys_unstable_apis"]

I don't believe me targeting wasm is an issue here, as my rust analyzer/compiler is complaining. I feel I'm missing a key idea with how dependencies work with rust, perhaps you could help educate on how I can minimumally config a Cargo.toml to run an example independent of the repo?

@Vrixyz
Copy link
Contributor

Vrixyz commented Jun 28, 2023

From your info, I can reproduce the issue 👍 :

I suspected multiple bevy version being used, to make sure I ran:
$ cargo tree -i bevy

It confirmed my suspicion:

error: There are multiple `bevy` packages in your project, and the specification `bevy` is ambiguous.
Please re-run this command with `-p <spec>` where `<spec>` is one of the following:
  https://github.com/bevyengine/bevy.git#bevy@0.11.0-dev
  https://github.com/bevyengine/bevy#0.11.0-dev

maybe the .git from my PR is enough to confuse dependency reconciliation, or maybe the difference between you specifying the rev=.. vs me specifying branch=main.. ; not sure, in the meantime I got a cargo.toml version that works:

[package]
name = "testegui"
version = "0.1.0"
edition = "2021"

[dependencies]
bevy = "0.11.0-dev"
bevy_egui = "*"

[patch.crates-io]
bevy = { git = 'https://github.com/bevyengine/bevy.git', branch = 'main' }
bevy_egui = { git = 'https://github.com/Vrixyz/bevy_egui', branch = 'bevy-main' }

@Zeenobit
Copy link

Zeenobit commented Jul 9, 2023

@Vrixyz Thanks for updating this! Using the patch in your post, I get the following error in my project:
"the trait bevy::prelude::Component is not implemented for bevy_egui::EguiContext"

This is my Cargo.toml:

[dependencies]
bevy = { version = "0.11.*", default-features = false }
bevy_egui = { version = "*", features = [ "immutable_ctx" ] }

[patch.crates-io]
bevy_egui = { git = "https://github.com/Vrixyz/bevy_egui", branch = "bevy-main" }

Any clues?

Edit: Solved it. I didn't realize I had to put the patch snippet in the root Cargo.toml. Thanks again for this!

@vladbat00
Copy link
Owner

Released as part of 0.21.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants