bevy_mod_scripting
bevy_mod_scripting copied to clipboard
:bug: Sending a callback event on the same frame as AddStaticScript it fails
Summary
I would want to load a script and execute a callback on the same frame. For instance, I load a scenario and I want to trigger the on_scenario_start function.
commands.queue(AddStaticScript::new(handle.clone()));
events.write(ScriptCallbackEvent::new_for_all_scripts(
OnTest,
vec![],
));
I get :
2025-08-28T22:10:18.921977Z ERROR bevy_mod_scripting_core::handler: error in script `id AssetId<bevy_mod_scripting_core::asset::ScriptAsset>{ index: 0, generation: 0}`: Missing context for script id AssetId<bevy_mod_scripting_core::asset::ScriptAsset>{ index: 0, generation: 0}. Was the script loaded?..
Context:
Lua
Reproducing
https://github.com/Ownezx/bms_min_repro/issues