Closed Davoodeh closed 6 months ago
Hi, glad you like the plugin.
As already mentioned, check if any dependencies pull in different versions of bevy_egui. This is most likely what is happening because I am pretty certain this is the exact issue I was getting after a major bevy update while bevy_egui hadn't been updated yet.
If that fails, give me a minimal reproducible example and I will see what I can find out.
I can reproduce the error if I run:
cargo run --example advanced --features bevy_egui
However that is expected because the advanced example doesn't add the EguiPlugin
. So make sure EguiPlugin
is added to your app.
Thank you for your fast response. I implemented my own version of your crate off of bevy@examples/helpers/camera_controller.rs
(I just want an interactive graph tool so did not invest so much time in it so I just dropped your solution early, sorry).
However that is expected because the advanced example doesn't add the
EguiPlugin
. So make sureEguiPlugin
is added to your app.
Regardless, I can confirm that EguiPlugin
was directly and indirectly early enough in all my attempts.
For any other beginner reading this wondering what I did: Copy the solution from camera_controllers, add to states to CameraController
for current and previous frames as in egui.rs
in this repository. Simply add a function like below to the systems and it works. I also incorporated features and mine is now past this function but I don't think the more convoluted code will help for beginners like me:
fn run_update_mouse_disable_flags(
mut contexts: bevy_egui::EguiContexts,
mut query: Query<&mut CameraController, With<Camera>>,
windows: Query<Entity, With<Window>>,
) {
// NOTE needs Rust (MSRV) 1.65
let Ok(mut controller) = query.get_single_mut() else {
return;
};
// The window that the user is interacting with and the window that contains the egui
// context that the user is interacting with are always going to be the same. Therefore, we
// can assume that if any of the egui contexts want focus, then it must be the one that the
// user is interacting with.
let new_wants_focus = windows.iter().any(|window| {
let ctx = contexts.ctx_for_window_mut(window);
ctx.wants_pointer_input() || ctx.wants_keyboard_input()
});
let check = (controller.disable_mouse_this_frame, new_wants_focus);
// set_if_neq
if check
!= (
controller.disable_mouse_previous_frame,
controller.disable_mouse_this_frame,
)
{
controller.disable_mouse_previous_frame = check.0;
controller.disable_mouse_this_frame = check.1;
}
}
To use it, I simply add a return if criterion up above one or two systems related to managing inputs. It's not much really but gets the job done pretty fast for newbies like me with experimenting goals in mind.
Mentioned files:
Sounds like aren't using this plugin any more, so I will close this issue.
Thank you!
I will notify if I used it again and found the bottom of the issue.
Hello,
Thank you for your awesome crate. It is a huge help to the bevy beginners. I'm fairly new to the bevy scene. I ran into this error and some errors regarding
Context
(which I couldn't reproduce) on my machine. I am not sure if this is me having a corrupt and very old installation of an OS or this is due to some bug in the program or bevy.Error
Initially, I was working on my own project and ran into this error:
Resource requested by bevy_panorbit_camera::egui::check_egui_wants_focus does not exist: bevy_egui::EguiUserTextures
As it is an egui error, it happens whenbevy_egui
is featured.What I did
After some tinkering with values and plugins, I suspected the versions. I used
bevy_egui
crate in0.25
and0.26
with and without featurerender
also checked bevy with its own render feature. Nothing worked on my project when having full dependencies as the following:Assuming I am the main criminal here for skipping through the documentations and notes, I used your own examples. Both with a
[workspace]
empty config and without one on a fresh config (not that it matters just thought I mention). Again, I went forward and edited flags on your ownCargo.toml
(therender
thing). Also tried to bump to version0.26
.The demo
advanced
ALWAYS crashed. 100% of the times.egui
worked when the version was0.25
without any other dependency in my own project.Searching in the internet, I didn't find anything mostly because I am still not efficient in googling bevy related stuff. This caught my eye and I tried to contact the author of the issue as well so I just link it here for future reference.
_Originally posted by @lambdadeltakay in https://github.com/mvlabat/bevy_egui/issues/252#issuecomment-2018554081_
All in all, I thought I report this for the sake of being documented. I have no idea how can I contribute to fix the issue as I am still learning bevy. But if I can make a blind guess, it guess the problem lies within this package. Please let me know if I can help in any capacity.
I am using a recent update of Arch (altho old in installation and pretty much it has its own set of problems) and I attached a full trace down below.