-
-
Notifications
You must be signed in to change notification settings - Fork 877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible wrong order of on_destroy calls #1169
Comments
Actually, the behavior is correct and by design. Maybe it needs to be better described though, especially now that entities have their own storage. In fact, entity storage is nothing more than another storage used by the registry and the users for validity checks. Nothing more, nothing less. |
Hi, Listeners for the construction signals are invoked after components have been assigned to entities. 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.” what I’m trying to do with this - is to make backup of deleted entity with all its components, and callback like that seemed perfect place to write saving code. Thank you! |
Roughly speaking, the three sentences are right. The fact is that they apply to their own storage. Like, from the beginning.
Wut? No, I wouldn't do so to be honest. A matter of tastes ofc but I'd prefer to mark entities to back up with a component and have a system that does so. I don't like doing heavy things in a signal callback. You never know when it fires after a while. On the other hand, a system is invoked during your loop at a specific position, no matter what. |
Hello,
I spotted strange problem with entity destruction: On the wiki there is statement "Listeners for the destruction signals are invoked before components have been removed from entities." which have sense. But when I register on_destroy callback I see an entity without any component associated with it. I tested it on todays latest ENTT with code:
and the result is:
![image](https://private-user-images.githubusercontent.com/608799/360529292-7be81801-f01d-4353-85dd-9fedb2ba72f6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUyMDQ1MTYsIm5iZiI6MTcyNTIwNDIxNiwicGF0aCI6Ii82MDg3OTkvMzYwNTI5MjkyLTdiZTgxODAxLWYwMWQtNDM1My04NWRkLTlmZWRiMmJhNzJmNi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTAxJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwMVQxNTIzMzZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zMjhjMTQ5ZjdjMTNmMmY4NTE4MjNiYmUzMjIxNWI4OWFiNDBjZGJhMjI1ZTVmOTU1MzQzMjNhNzUyMzExMGY2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.cZU8cmH3p9nT44q-v4wlAsVtYtbAl_m8uKFsV_-IuFY)
I think the order of calls is wrong, or at least the fact that on_destroy callback of entity happens at the time when any contextual information about entity is already destroyed is not according to the documentation.
Can you please verify if it is a bug, or it is intended behaviour of the system?
The text was updated successfully, but these errors were encountered: