-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Send Priority event from ScriptWorld #74
Comments
Hi @zwazel thanks! /// Sends a batch of [`Event`]s from an iterator.
#[inline]
pub fn send_event_batch<E: Event>(&mut self, events: impl IntoIterator<Item = E>) {
match self.get_resource_mut::<Events<E>>() {
Some(mut events_resource) => events_resource.extend(events),
None => bevy_utils::tracing::error!(
"Unable to send event `{}`\n\tEvent must be added to the app with `add_event()`\n\thttps://docs.rs/bevy/*/bevy/app/struct.App.html#method.add_event ",
std::any::type_name::<E>()
),
}
} in this case instead of /// Sends a batch of [`Event`]s from an iterator.
#[inline]
pub fn send_event_batch<E: Event>(&mut self, events: impl IntoIterator<Item = E>, prio: u32) {
match self.get_resource_mut::<PriorityEvents<E>>() {
Some(mut events_resource) =>events_resource.events.extend(events.map(|v| EventInstance::new(v, prio))),
None => bevy_utils::tracing::error!(
"Unable to send event `{}`\n\tEvent must be added to the app with `add_event()`\n\thttps://docs.rs/bevy/*/bevy/app/struct.App.html#method.add_event ",
std::any::type_name::<E>()
),
}
} |
I should probably extend the |
Hi, love this crate!
I just came across a small issue.
I need to send out PriorityEvents from a rust function that is registered as a script function.
So it has only access to the ScriptWorld.
With the Normal Bevy Events I can just use world.send_event().
But I can't seem to figure out how to send out priority events with only having the ScriptWorld.
Did I miss anything?
The text was updated successfully, but these errors were encountered: