ten3roberts / flax

Batteries included ECS library for rust with entity relations and much more
78 stars 5 forks source link

Inquiry: spawn_at despawn existing or fail #3

Closed ten3roberts closed 7 months ago

ten3roberts commented 2 years ago

What are your opinions for spawn_at and similar functions: should the fail if an entity with the same entity already exists or should they despawn the previous one.

E.g; spawn_at(2v4) will despawn 2v3 if it exists.

Having it despawn makes the api simpler as they don't have to return a result. However, it may cause bugs where other important entities are despawned unintentionally.

There is a reserve entity id feature which allows you to spawn blank entities and override them spawn_at without first having to despawn the placeholder, as you would need to if you spawned a normal entities with no components.