amethyst / amethyst/editor-core

Add new components to entities at runtime

Abierto
#31 0 comentarios 0 reacciones 0 asignados Ver en GitHub
enhancement help wanted
Lenguaje dominante
Rust
Estrellas
45
Forks
8
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

> ~~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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.