diff --git a/Engine/source/T3D/entity.cpp b/Engine/source/T3D/entity.cpp index cf4885f9f..5b13ca47a 100644 --- a/Engine/source/T3D/entity.cpp +++ b/Engine/source/T3D/entity.cpp @@ -1391,7 +1391,7 @@ void Entity::clearComponents(bool deleteComponents) { while (mComponents.size() > 0) { - Component* comp = mComponents.first(); + Component* comp = mComponents.last(); if (comp) { @@ -1399,6 +1399,7 @@ void Entity::clearComponents(bool deleteComponents) comp->deleteObject(); } + mComponents.pop_back(); } } }