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

BRP Resource methods #17423

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Conversation

mweatherley
Copy link
Contributor

Objective

So far, built-in BRP methods allow users to interact with entities' components, but global resources have remained beyond its reach. The goal of this PR is to take the first steps in rectifying this shortfall.

Solution

Added five new default methods to BRP:

  • bevy/get_resource: Gets the value of a resource with a given name.
  • bevy/insert_resource: Serializes an input value to a given resource type and inserts it into the world.
  • bevy/remove_resource: Removes the given resource from the world.
  • bevy/mutate_resource: Replaces the value of a field in a given resource with the result of serializing a given input value.
  • bevy/list_resources: Lists all resources in the type registry with an available ReflectResource.

Testing

Updates to the remote server example incoming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant