amethyst / amethyst/editor-core
Add new components to entities at runtime
- Langage dominant
- Rust
- Étoiles
- 45
- Forks
- 8
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
> ~~This is currently blocked by #27.~~
Add a way for editors to request that a new component be added to an existing entity at runtime. The editor should specify the ID for the component type (i.e. the user-provided name for the type) and the entity it should be attached to. The game should then create the corresponding component in the game world.
Since the editor currently knows nothing about the type definitions for components, it won't know how to create the data for a new component when adding one. Instead, we'll leave it to the game process to use `Default` or similar user-provided logic to create the new component directly within the game.
To do this, add a new variant to `IncomingMessage` called `AddComponent` that specifies the ID for the component type and the entity the component should be added to. We'll also likely have to add `Default` as a bound for `WriteComponentSet`.
Note that it may prove insufficient to use `Default` for some component types, since they may require data from resources or other components when being initialized. If this proves to be the case, we can discuss adding a new trait such as `ComponentDefault` that allows users to access world state when creating default values for a component.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.