You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm in favor.
Note that we went through many designs and this seems the cleanest by far imo. Bevy does not have the required answer to "How do I spawn an object composed of lots of stuff?" yet while still returning an EntityCommands, so we need to introduce an abstraction here.
benfrankel
changed the title
Replace observers for spawning entities with an EntityCommand-based abstraction
Spawn entities with an EntityCommand-based abstraction
Aug 8, 2024
An example of how the proposed API looks in practice: https://github.com/benfrankel/bevy_jam_template/blob/main/src/screen/title.rs.
Benefits:
EntityCommands
back immediately.SystemParam
s ergonomically by adding them as arguments.struct Projectile { lifetime, .. }
).struct Projectile
.EntityCommand
forProjectile
, and delegate to the spawning system withworld.run_system_once_with((id, self), projectile)
.In(id): In<Entity>
toIn((id, this)): In<(Entity, Projectile)>
.Drawbacks:
spawn_fn
andspawn_with
unfortunately couldn't be merged into one method.The text was updated successfully, but these errors were encountered: