diff --git a/src/scene/src/entity.cpp b/src/scene/src/entity.cpp index bf03ddd..6e4deb7 100644 --- a/src/scene/src/entity.cpp +++ b/src/scene/src/entity.cpp @@ -26,11 +26,11 @@ void entity::add_child(entity& child) // TODO: check circular dependencies // declare child relationship - auto r = get_or_create_component(); + auto& r = get_or_create_component(); r.children.push_back(child._entity); // declare parent - auto p_r = child.get_or_create_component(); + auto& p_r = child.get_or_create_component(); p_r.parent = _entity; } @@ -45,13 +45,13 @@ void entity::remove_child(entity& child) if (has_component() && child.has_component()) { // we need to check if the child is related to the parent - auto r_p = child.get_component(); + auto& r_p = child.get_component(); if (r_p.parent == _entity) { // now go ahead r_p.parent = entt::null; - auto r = get_component(); + auto& r = get_component(); std::remove(r.children.begin(),r.children.end(),child._entity); }