diff --git a/application/uilayer.cpp b/application/uilayer.cpp index 27bc2493..4e11dad6 100644 --- a/application/uilayer.cpp +++ b/application/uilayer.cpp @@ -496,12 +496,16 @@ void ui_layer::render_entity_hierarchy(ECWorld& world) for (auto entity : world.GetEntities()) { - char buf[64]; - std::snprintf(buf, sizeof(buf), "Entity %u", static_cast(entity)); + std::string buf; + buf.reserve(64); + if (world.HasComponent(entity)) + buf = world.GetComponent(entity) -> Name.ToString(); + else + buf = std::to_string(static_cast(entity)); const bool selected = (m_selected_entity == entity); - if (ImGui::Selectable(buf, selected)) + if (ImGui::Selectable(buf.c_str(), selected)) { m_selected_entity = entity; }