Sorting entity list by name to keep consistent order in hierarchy view

This commit is contained in:
Antoine Pilote
2024-08-16 17:57:29 -04:00
parent c996b9b114
commit 2aa54db49e

View File

@@ -302,6 +302,12 @@ namespace Nuake
allEntities.push_back(newEntity);
}
}
// Temporary fix to prevent order of tree to change randomly until actual order is implemented.
std::sort(allEntities.begin(), allEntities.end(), [](Entity a, Entity b) {
return a.GetComponent<NameComponent>().Name < b.GetComponent<NameComponent>().Name;
});
return allEntities;
}