bevyengine / bevyengine/bevy

Child "component" for required components

Open
#16,840 0 comments 14 reactions 0 assignees View on GitHub
A-ECS C-Feature S-Needs-Design
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?
A common part (as far as my code base is concerned, and looking at a few test projects I could find online) is creating entities and then adding children to said entity, to create a hierarchical system to a project. A useful feature would be to add a component that can be tagged onto a require set, allowing for a type to be automatically added to the entity when created as a child.

## What solution would you like?
```rust
#[derive(Component)]
#[require(Child)]
struct ExampleComponent;
```

## What alternative(s) have you considered?
The current solution to this project is just directly adding a child upon creating the entity at runtime, instead of assuring a compile time creation.

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.