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

[Merged by Bors] - disable window pre creation for ios #5883

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions crates/bevy_winit/src/lib.rs
Expand Up @@ -48,13 +48,15 @@ impl Plugin for WinitPlugin {
#[cfg(target_arch = "wasm32")]
app.add_plugin(web_resize::CanvasParentResizePlugin);
let event_loop = EventLoop::new();
#[cfg(not(target_os = "android"))]
#[cfg(not(any(target_os = "android", target_os = "ios", target_os = "macos")))]
let mut create_window_reader = WinitCreateWindowReader::default();
#[cfg(target_os = "android")]
#[cfg(any(target_os = "android", target_os = "ios", target_os = "macos"))]
let create_window_reader = WinitCreateWindowReader::default();
// Note that we create a window here "early" because WASM/WebGL requires the window to exist prior to initializing
// the renderer.
#[cfg(not(target_os = "android"))]
shuoli84 marked this conversation as resolved.
Show resolved Hide resolved
// And for ios and macos, we should not create window early, all ui related code should be executed inside
// UIApplicationMain/NSApplicationMain.
#[cfg(not(any(target_os = "android", target_os = "ios", target_os = "macos")))]
handle_create_window_events(&mut app.world, &event_loop, &mut create_window_reader.0);
app.insert_resource(create_window_reader)
.insert_non_send_resource(event_loop);
Expand Down