specs
specs copied to clipboard
Unclear relationship Entity Id and World::fetch_by_id
First of all, I am pretty new to specs and I have been a bit confused by the value returned by World::create_entity
as it does not seem to serve a specific purpose. I had assumed it would be possible to access that specific entity directly or to retrieve it from the world
struct. This does not seem to be the case. (If I figured this out correctly, this is to be done by using an empty Tag in a NullStorage.)
When I looked at the World
struct I thought I would be able to access the specific entity with the method World::fetch_mut_by_id
. I also tried to find that method used within the examples but found nothing.
Are these methods just obsolete? Is there another way to just extract an entity quickly by it's Entity Id?
I think you have misunderstanding on what entity is in ECS. That id returned by create_entity
is the entity and nothing else. You can fetch components associated with it by that id, but there is no such thing as fetching entity.
Also by World::fetch_mut_by_id
you mean World::try_fetch_mut_by_id
? That is for fetching resources which are basically some values stored in world which can be used to share some resource between systems.
Closing since this seems to be answered. If further discussion is needed please re-open or open another issue!