Sdk/Entity: Add OnEntityDestruction callback

This commit is contained in:
Lynix
2017-03-03 17:52:19 +01:00
parent 605e5c2fd0
commit 3fe54ff777
2 changed files with 6 additions and 0 deletions

View File

@@ -145,6 +145,9 @@ namespace Ndk
void Entity::Destroy()
{
OnEntityDestruction(this);
OnEntityDestruction.Clear();
// We prepare components for entity destruction (some components needs this to handle some final callbacks while the entity is still valid)
for (std::size_t i = m_componentBits.FindFirst(); i != m_componentBits.npos; i = m_componentBits.FindNext(i))
m_components[i]->OnEntityDestruction();