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

return_after_run example is broken #6311

Closed
rparrett opened this issue Oct 19, 2022 · 5 comments
Closed

return_after_run example is broken #6311

rparrett opened this issue Oct 19, 2022 · 5 comments
Labels
A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior C-Examples An addition or correction to our examples
Milestone

Comments

@rparrett
Copy link
Contributor

There are multiple issues with this example.

  • The ClearColor which is meant to visually distinguish the first app from the next is never shown because there are no cameras. This has been broken between Bevy 0.7 and Bevy 0.8 with the Camera Driven Rendering stuff.

  • Since the recent winit upgrade, we get this error after the first window is closed.

thread 'main' panicked at 'Creating EventLoop multiple times is not supported.', /Users/robparrett/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.4/src/event_loop.rs:106:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  • Prior to that, I think this was still broken on at least MacOS with a different error after closing the first window.
thread 'main' panicked at 'The panic info must exist here. This failure indicates a developer error.', /Users/robparrett/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/platform_impl/macos/app_state.rs:375:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /Users/robparrett/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/platform_impl/macos/event_loop.rs:237:55

Additional information

AdapterInfo { name: "Apple M1 Max", vendor: 0, device: 0, device_type: DiscreteGpu, backend: Metal }
@rparrett rparrett added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Oct 19, 2022
@alice-i-cecile alice-i-cecile added C-Examples An addition or correction to our examples A-Windowing Platform-agnostic interface layer to run your app in and removed S-Needs-Triage This issue needs to be labelled labels Oct 19, 2022
@rparrett
Copy link
Contributor Author

It seems that we're just not allowed to do what we're doing in that example anymore.

https://github.com/rust-windowing/winit/blob/v0.27.4/src/event_loop.rs#L82

So I guess we just need to find another way to demonstrate return_from_run?

@mockersf
Copy link
Member

So I guess we just need to find another way to demonstrate return_from_run?

Yup... let's try to find a good use case for it.

Putting this in the 0.9 milestone. Worst case fix is to remove the second app and show that the final println is printed

@mockersf mockersf added this to the Bevy 0.9 milestone Oct 20, 2022
@rparrett
Copy link
Contributor Author

rparrett commented Oct 20, 2022

Some background info in #167 for anyone digging into this. I still don't feel informed about how people are using this feature.

@CGMossa
Copy link
Contributor

CGMossa commented Oct 20, 2022

I believe this is a critical feature for users outside of gaming; As an example, take this feature:

Entities can be transferred between worlds without serialisation using the World::transfer method. We use this to completely remove entities from the simulation while keeping their full dynamic state around for later inspection.
which comes from rs-ecs

@mockersf
Copy link
Member

I'm not sure I see the relation between being able to run multiple windows one after the other and transferring entities between worlds?

@bors bors bot closed this as completed in 5588596 Oct 31, 2022
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
# Objective

- Fixes  bevyengine#6311
- Make it clearer what should be done in the example (close the Bevy app window)

## Solution

- Remove the second windowed Bevy App [since winit does not support this](https://github.com/rust-windowing/winit/blob/v0.27.4/src/event_loop.rs#L82-L83)
- Add title to the Bevy window asking the user to close it

This is more of a quick fix to have a working example. It would be nicer if we had a small real usecase for this functionality.
Another alternativ that I tried out: If we want to showcase a second Bevy app as it was before, we could still do this as long as one of them does not have a window. But I don't see how this is helpful in the context of the example, so I stuck with only one Bevy app and a simple print afterwards.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior C-Examples An addition or correction to our examples
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants