Skip to content

Commit c5f1bb4

Browse files
prose
1 parent 5939416 commit c5f1bb4

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

crates/bevy_ecs/src/entity/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ struct EntityMeta {
12041204
pub generation: EntityGeneration,
12051205
/// The current location of the [`EntityRow`].
12061206
pub location: EntityLocation,
1207-
/// Location of the last spawn, despawn or flush of this entity.
1207+
/// Location and tick of the last spawn, despawn or flush of this entity.
12081208
spawned_or_despawned: SpawnedOrDespawned,
12091209
}
12101210

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Flushing
3+
pull_requests: [19350]
4+
---
5+
6+
`Entities::flush` now also asks for metadata about the flush operation
7+
that will be stored for the flushed entities. For the source location,
8+
`MaybeLocation::caller()` can be used; the tick should be retrieved
9+
from the world.

release-content/release-notes/entity-spawn-ticks.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Entity Spawn Ticks
3-
authors: ["@urben1680"]
4-
pull_requests: [19047]
3+
authors: ["@urben1680", "@specificprotagonist"]
4+
pull_requests: [19047, 19350]
55
---
66

77
Keeping track which entities have been spawned since the last time a system ran could only be done indirectly by inserting marker components and do your logic on entities that match an `Added<MyMarker>` filter or in `MyMarker`'s `on_add` hook.
@@ -23,12 +23,11 @@ fn print_spawn_details(query: Query<(Entity, SpawnDetails)>) {
2323
print!("new ");
2424
}
2525
print!(
26-
"entity {:?} spawned at {:?}",
27-
entity,
26+
"entity {entity:?} spawned at {:?}",
2827
spawn_details.spawned_at()
2928
);
3029
match spawn_details.spawned_by().into_option() {
31-
Some(location) => println!(" by {:?}", location),
30+
Some(location) => println!(" by {location:?}"),
3231
None => println!()
3332
}
3433
}
@@ -80,4 +79,4 @@ fn filter_spawned_after(
8079

8180
The tick is stored in `Entities`. It's method `entity_get_spawned_or_despawned_at` not only returns when a living entity spawned at, it also returns when a despawned entity found it's bitter end.
8281

83-
Note however that despawned entities can be replaced by bevy at any following spawn. Then this method returns `None` for the despawned entity. The same is true if the entity is not even spawned yet, only allocated.
82+
Note however that despawned entities can be replaced by Bevy at any following spawn. Then this method returns `None` for the despawned entity. The same is true if the entity is not even spawned yet, only allocated.

0 commit comments

Comments
 (0)