From 99b4fb68cc21847a98b135bdf4b0df87dc200399 Mon Sep 17 00:00:00 2001 From: Philpax Date: Fri, 3 May 2024 22:12:27 +0200 Subject: [PATCH] Fix `custom_loop` example to include plugin finalization (#13215) # Objective The `custom_loop` example didn't replicate the `app.finish` / `app.cleanup` calls from the default runner; I discovered this when trying to troubleshoot why my application with a custom loop wasn't calling its plugin finalizers, and realised that the upstream example that I'd referenced didn't have the relevant calls. ## Solution Added the missing calls, replicating what the default runner does: https://github.com/bevyengine/bevy/blob/d3904200939ee6b2c0ee5f9293ad35ba8315cbfc/crates/bevy_app/src/app.rs#L895-L896 ## Testing I've confirmed that adding these two calls to my application fixed the issue I was encountering. I haven't tested it within the example itself as it's relatively straightforward and I didn't want to pollute the example with a plugin using a finalizer. --- examples/app/custom_loop.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/app/custom_loop.rs b/examples/app/custom_loop.rs index 61796d1c57..0dd3dfeddc 100644 --- a/examples/app/custom_loop.rs +++ b/examples/app/custom_loop.rs @@ -8,6 +8,11 @@ use std::io; struct Input(String); fn my_runner(mut app: App) -> AppExit { + // Finalize plugin building, including running any necessary clean-up. + // This is normally completed by the default runner. + app.finish(); + app.cleanup(); + println!("Type stuff into the console"); for line in io::stdin().lines() { {