Skip to content

Commit

Permalink
don't create windows on winit StartCause::Init event (#9684)
Browse files Browse the repository at this point in the history
# Objective

- #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 '<unnamed>' 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
  • Loading branch information
mockersf authored Sep 23, 2023
1 parent 0181d40 commit b416d18
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/bevy_winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit b416d18

Please sign in to comment.