Sdk/BaseComponent: Add OnEntityDestruction callback
Also fixes physics component callbacks (OnContactEnd by example) being fired while entity is destroyed
This commit is contained in:
@@ -88,5 +88,11 @@ namespace Ndk
|
||||
m_object.reset();
|
||||
}
|
||||
|
||||
void PhysicsComponent2D::OnEntityDestruction()
|
||||
{
|
||||
// Kill rigidbody before entity destruction to force contact callbacks to be called while the entity is still valid
|
||||
m_object.reset();
|
||||
}
|
||||
|
||||
ComponentIndex PhysicsComponent2D::componentIndex;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user