Skip to content
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

Expose a public constructor for Mut #6497

Closed
alice-i-cecile opened this issue Nov 6, 2022 · 0 comments · Fixed by #7931
Closed

Expose a public constructor for Mut #6497

alice-i-cecile opened this issue Nov 6, 2022 · 0 comments · Fixed by #7931
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use
Milestone

Comments

@alice-i-cecile
Copy link
Member

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 the set_last_changed API).

What alternative(s) have you considered?

Users can already construct arbitrary Mut values directly, via APIs like world.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.

@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use labels Nov 6, 2022
@james7132 james7132 added this to the 0.11 milestone Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants