bevyengine / bevyengine/bevy

Change #[require()] to use FromWorld > Default

Open
#21,716 3 comments 0 reactions 0 assignees View on GitHub
A-ECS C-Feature S-Needs-Investigation X-Contentious
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## What problem does this solve or what need does it fill?
It would be nice to configure the default value of a required component at runtime; currently, the require meta needs the type to implement Default, which takes in no parameters and so is fixed at compile.

It would be nice if it instead used FromWorld. This shouldn't break any pre-existing things since any type with Default auto-derives FromWorld, but it would mean that it's possible to have custom logic for what the value is based on the world.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.