bevy
bevy copied to clipboard
Remove need for EventLoopProxy to be NonSend
Objective
- Continue to pare down the uses on NonSend resources in the engine. In this case, EventLoopProxy used to be
!Sync, but is nowSyncin the latest version of winit.
Solution
- New type
EventLoopProxyasEventLoopProxyWrapperto make it into a normal resource. - Update the
custom_user_eventexample as it no longer needs to indirectly access theEventLoopProxythrough a static variable anymore.
Testing
- Ran the example. The resource exists just for users to use, so there aren't any in engine uses for it currently.
Changelog
- make EventLoopProxy into a regular resource.
Migration Guide
EventLoopProxy has been renamed to EventLoopProxyWrapper and is now Send, making it an ordinary resource.
Before:
event_loop_system(event_loop: NonSend<EventLoopProxy<MyEvent>>) {
event_loop.send_event(MyEvent);
}
After:
event_loop_system(event_loop: Res<EventLoopProxy<MyEvent>>) {
event_loop.send_event(MyEvent);
}