#How to get id's from spawn_batch? (Edit: Wrote spawn_bundle instead of spawn_batch)

1 messages · Page 1 of 1 (latest)

flint crown
#

Is there any way to get id's from the entities created with spawn_batch like with spawn?

midnight obsidian
#

It should be .id()

solid matrix
#
let enemy = commands
                                .spawn(EnemyBundle::new(enemy_meta, pos.extend(100.0)))
                                .id();
                            level.enemies.push(
                                enemy,
                            );
flint crown
#

How to get id's from spawn_batch? (Edit: Wrote spawn_bundle instead of spawn_batch)

midnight obsidian
#

I don't think there is a way to get those IDs since the spawn_batch command is deferred. To get around this, you could consider adding your own ID components to the bundle and using that to identify the entities later to extract the Entity ID

flint crown
midnight obsidian
#

Yeah

#

That's what I would do anyways

#

Someone else may have a better solution haha