Commit Graph

2 Commits

Author SHA1 Message Date
Chris Russell 753f3ca1be Add write methods to MessageMutator (#23351)
# Objective

Support systems that both read and write messages of the same type.  

This is possible today with various workarounds: Either using
`ParamSet<(MessageReader<M>, MessageWriter<M>)>` or by manually storing
a `Local<MessageCursor<DebugMessage>>` to keep track of the reading
position. But those are both relatively complex for such a simple use
case.

The `ParamSet` workaround would get even more complex if we did #23339,
since it would be necessary to use a fallible system to handle the case
where the `Messages` resource is missing.

## Solution

Create a type that can both read and write messages. It needs to have a
`MessageCursor` and `ResMut<Messages<M>>`... which is exactly what
`MessageMutator<M>` has!

So, rather than creating a new type, simply add `write`, `write_batch`,
and `write_default` to `MessageMutator`.

Update the documentation to point users to use `MessageMutator` rather
than `ParamSet` or `MessageCursor`.
2026-03-14 05:24:07 +00:00
Carter Anderson 4d74baf1ae BufferedEvent -> Message Rename (#20953)
This renames the concept of `BufferedEvent` to `Message`, and updates
our APIs, comments, and documentation to refer to these types as
"messages" instead of "events". It also removes/updates anything that
considers messages to be "observable", "listenable", or "triggerable".

This is a followup to https://github.com/bevyengine/bevy/pull/20731,
which omitted the `BufferedEvent -> Message` rename for brevity.

See that post for rationale.
2025-09-10 21:04:15 +00:00