bevyengine / bevyengine/bevy

Allow for instantiation of SystemParam from immutable World

Open
#16,216 2 comments 0 reactions 0 assignees View on GitHub
A-ECS C-Feature D-Modest S-Needs-Design
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## What problem does this solve or what need does it fill?

I am doing declarative programming architectures in bevy Ui where i use boxed traits inside of components to update Ui elements every frame with &World.

I wrapped a few of my asset related resources in a SystemParam like this and while i can access the resources individually from &World, it seems extremely silly that i can see no way to access the system param from &World thus my internal functions become messier .

## What solution would you like?

This is what i would like to instantiate from &World ...

Just a struct w 4 readonly resources .

‘’’

#[derive(SystemParam)]
pub struct DialogDataLoadExt<'w> {
dialog_assets_resource: Res<'w, DialogAssets>,
dialog_assets: Res<'w, Assets>,
lore_node_assets: Res<'w,Assets>,
lore_set_assets: Res<'w, Assets>,
}
‘’’

## What alternative(s) have you considered?

I could just not use systemparams ..? That kind of sucks as it is nice to bundle readonly resources into one param

## Additional context

Bevy 14.2

Contributor guide

Open the contributing guide

Research direction

Start by reading Bevy's SystemParam and World entry points, especially how Res resources are obtained from an immutable World and how the derive(SystemParam) macro is used. Compare the requested four readonly resources with existing SystemParam behavior and tests; done means a supported, documented way to instantiate the bundled parameter from &World.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.