amethyst / amethyst/editor-core

Add new components to entities at runtime

オープン
#31 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement help wanted
主要言語
Rust
スター
45
フォーク
8
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。