Expose a public constructor for Mut
#6497
Labels
A-ECS
Entities, components, systems, and events
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
Milestone
What problem does this solve or what need does it fill?
While ordinarily
Mut
should not be constructed directly by users (and instead should be retrieved via querying), it can be very useful when writing bevy-external tests.What solution would you like?
Create a
Mut::new(value: T, ticks: Ticks)
method.Carefully document that this is an advanced API, and explain how to correctly set the
Ticks
value (following theset_last_changed
API).What alternative(s) have you considered?
Users can already construct arbitrary
Mut
values directly, via APIs likeworld.get_mut()
. This may involve creating a dummy world, which is wasteful, confusing and roundabout.Additional context
Discussed on Discord in the context of testing asset code with @djeedai, @maniwani and @JoJoJet.
The text was updated successfully, but these errors were encountered: