A subtle tip for people integrating #egui with a game engine:
egui provides wants_pointer_input(), which tells you if the mouse is over a UI element. If so, the rest of the game should not receive mouse input. Same with wants_keyboard_input().
egui doesn't know if it wants input until *after* you call end_frame(). So you should run your UI code at the beginning of the game loop, before the rest of your game receives events or does updates.