amethyst / amethyst/editor-core

Add new components to entities at runtime

Đang mở
#31 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement help wanted
Ngôn ngữ chính
Rust
Star
45
Fork
8
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.