Skip to content

Commit e9e6c3a

Browse files
authored
fix: enable_context_sharing not returning the plugin like a real builder
1 parent eb9b36c commit e9e6c3a

File tree

1 file changed

+4
-3
lines changed
  • crates/bevy_mod_scripting_core/src

1 file changed

+4
-3
lines changed

crates/bevy_mod_scripting_core/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ pub trait ConfigureScriptPlugin {
183183
/// Switch the context assigning strategy to a global context assigner.
184184
///
185185
/// This means that all scripts will share the same context. This is useful for when you want to share data between scripts easilly.
186-
/// Be careful however as this also means that scripts can interfere with each other in unexpected ways!.
187-
fn enable_context_sharing(self);
186+
/// Be careful however as this also means that scripts can interfere with each other in unexpected ways! Including overwriting each other's handlers.
187+
fn enable_context_sharing(self) -> Self;
188188
}
189189

190190
impl<P: IntoScriptPluginParams + AsMut<ScriptingPlugin<P>>> ConfigureScriptPlugin for P {
@@ -209,8 +209,9 @@ impl<P: IntoScriptPluginParams + AsMut<ScriptingPlugin<P>>> ConfigureScriptPlugi
209209
self
210210
}
211211

212-
fn enable_context_sharing(mut self) {
212+
fn enable_context_sharing(mut self) -> Self{
213213
self.as_mut().context_assigner = ContextAssigner::new_global_context_assigner();
214+
self
214215
}
215216
}
216217

0 commit comments

Comments
 (0)