#Can I read events without consuming them ?
15 messages · Page 1 of 1 (latest)
yeah, or make a run condition for the event reading system so that it doesn't even run until you want it to run and read the events.
I might be in a situation where I want to consume some events though 💀
I think I'll refactor a bit to add an "eventQueue" component to my entity, waiting to be consumed when ready.
yeah, especially if this event queue doesn't need to be read by anything else or is just for a specifc thing, it can easily just be a vec.
Yeah custom queue is probably the way. Normal events are dropped after two frames according to the docs: https://docs.rs/bevy/latest/bevy/ecs/event/struct.Events.html
An event collection that represents the events that occurred within the last two Events::update calls. Events can be written to using an EventWriter and are typically cheaply read using an EventReader.
yeah but with normal events you can self-manage them by opting out of this two frame clear.
By “normal” I meant those added with add_event which I don’t think you can opt out of (could be wrong)
in my case I eventually ruled into accepting that some events might be dropped, I'll consider the user responsible for missed event, and he should re-emit them 😅
you can indeed opt out of them.
obviously if you use add_event its opting in, so you were correct to say that. just clarifying that its all using Events<T>
Ah, yeah I could’ve been more clear. They’re all events at the end of the day. It’s how you initialize the resource that matters (since add_event also initializes the automatic cleanup systems)
you can opt out of that by using app.init_resource::<Events<T>>()