From dce9abb2f033aafd4d102cd9bba052465b391a77 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Fri, 13 Sep 2024 12:45:18 +0200 Subject: [PATCH] doc: more about signals - close #1169 --- docs/md/entity.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/md/entity.md b/docs/md/entity.md index eb7e69d05..09e814ad1 100644 --- a/docs/md/entity.md +++ b/docs/md/entity.md @@ -376,19 +376,17 @@ In all cases, the function type of a listener is equivalent to the following: void(entt::registry &, entt::entity); ``` -In all cases, listeners are provided with the registry that triggered the -notification and the involved entity. +All listeners are provided with the registry that triggered the notification and +the involved entity. Note also that: -Note also that: - -* Listeners for the construction signals are invoked **after** components have - been assigned to entities. +* Listeners for construction signals are invoked **after** components have been + created. * Listeners designed to observe changes are invoked **after** components have been updated. -* Listeners for the destruction signals are invoked **before** components have - been removed from entities. +* Listeners for destruction signals are invoked **before** components have been + destroyed. There are also some limitations on what a listener can and cannot do: @@ -435,7 +433,11 @@ registry.patch(entity); ``` Destroying an entity and then updating the version of an identifier **does not** -give rise to these types of signals under any circumstances instead. +give rise to these types of signals under any circumstances instead.
+Finally, note that listeners that _observe_ the destruction of an entity are +invoked **after** all components have been removed, not **before**. This is +because the entity would be invalidated before deleting its elements otherwise, +making it difficult for the user to write component listeners. ### Listeners disconnection