From b416d181a7e489df9a2b35f98e9e8038699586f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sat, 23 Sep 2023 08:28:49 +0200 Subject: [PATCH] don't create windows on winit StartCause::Init event (#9684) # Objective - https://github.com/bevyengine/bevy/pull/7609 broke Android support ``` 8721 8770 I event crates/bevy_winit/src/system.rs:55: Creating new window "App" (0v0) 8721 8769 I RustStdoutStderr: thread '' panicked at 'Cannot get the native window, it's null and will always be null before Event::Resumed and after Event::Suspended. Make sure you only call this function between those events.', winit-0.28.6/src/platform_impl/android/mod.rs:1058:13 ``` ## Solution - Don't create windows on `StartCause::Init` as it's too early --- crates/bevy_winit/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_winit/src/lib.rs b/crates/bevy_winit/src/lib.rs index d6ea22e368..92e6674674 100644 --- a/crates/bevy_winit/src/lib.rs +++ b/crates/bevy_winit/src/lib.rs @@ -366,7 +366,7 @@ pub fn winit_runner(mut app: App) { match event { event::Event::NewEvents(start_cause) => match start_cause { StartCause::Init => { - #[cfg(any(target_os = "android", target_os = "ios", target_os = "macos"))] + #[cfg(any(target_os = "ios", target_os = "macos"))] { #[cfg(not(target_arch = "wasm32"))] let (