Skip to content

Immutable Resources fix#24424

Open
Trashtalk217 wants to merge 5 commits into
bevyengine:mainfrom
Trashtalk217:immutable-resources-fix
Open

Immutable Resources fix#24424
Trashtalk217 wants to merge 5 commits into
bevyengine:mainfrom
Trashtalk217:immutable-resources-fix

Conversation

@Trashtalk217
Copy link
Copy Markdown
Contributor

Objective

Fixes #24285.

Solution

Add UnsafeWorldCell::get_resource_assume_mutable, World::modify_resource and World::modify_resource_by_id and updated the migration guide.

Testing

The new methods are essentially identical to their component counterparts.

@Trashtalk217 Trashtalk217 added the A-ECS Entities, components, systems, and events label May 24, 2026
@Trashtalk217 Trashtalk217 added this to the 0.19 milestone May 24, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in ECS May 24, 2026
@Trashtalk217
Copy link
Copy Markdown
Contributor Author

I don't know where all the migration guides have gone to, but for future reference: I'd like to add the following to the resources_as_components migration guide:

If it's not possible to add the bound, use either `UnsafeWorldCell::get_resource_mut_assume_mutable`, `UnsafeWorldCell::get_resource_by_id` and make sure that the safety conditions are satisfied. 
There's also `World::modify_resource` and `World::modify_resource_by_id`, that behave exactly like their component counterparts.
Lastly, it's also possible to use the `*_assume_mutable` component methods for this purpose, but you'd first have to retrieve the resource entity from `ResourceEntities`.

And also the PR number on the top.

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

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

Immutable resources need a migration guide

1 participant