bevy_concurrent_event

Crates.iobevy_concurrent_event
lib.rsbevy_concurrent_event
version0.1.0
sourcesrc
created_at2024-03-05 15:09:52.522075
updated_at2024-03-05 15:09:52.522075
descriptionA simple concurrent event plugin,the principle is similar to Commads,events can be send/read concurrently, but the reading of events is always in the next bevy frame
homepage
repository
max_upload_size
id1163154
size39,512
AntiAnimeGeneral (AntiAnimeGeneral)

documentation

README

"A simple concurrent event plugin,the principle is similar to Commads,events can be send/read concurrently, but the reading of events is always in the next bevy frame"

#[derive(Event)] struct E;

fn main() { App::new().add_event_manager::() .... ; } fn send(mut sender:EventsSender){ sender.send(e); ... } fn read(sender:EventsReader){ sender.par_iter()...//iter() }

use bevy::{ app::{App, Update}, ecs::event::Event, }; use bevy_concurrent_event::events::{ ConcurrentEvent, EventsReader, EventsSender, }; use rayon::iter::ParallelIterator;

#[derive(Event)] struct E;

pub fn main() { App::new().add_event_manager::().add_systems( Update, ( |mut s: EventsSender| s.send(E), |r: EventsReader| r.par_read().for_each(|_| {}), ), ); }

Commit count: 0

cargo fmt