diff --git a/Editor/src/Windows/EditorInterface.cpp b/Editor/src/Windows/EditorInterface.cpp index 96963f60..ea2c07e1 100644 --- a/Editor/src/Windows/EditorInterface.cpp +++ b/Editor/src/Windows/EditorInterface.cpp @@ -816,7 +816,8 @@ namespace Nuake { ImGui::PushFont(normalFont); // If has no childrens draw tree node leaf - if (parent.Children.size() <= 0) + bool isPrefab = e.HasComponent(); + if (parent.Children.size() <= 0 || isPrefab) { base_flags |= ImGuiTreeNodeFlags_Leaf; } @@ -856,7 +857,6 @@ namespace Nuake { } bool isDragging = false; - bool isPrefab = e.HasComponent(); if (nameComponent.IsPrefab && e.HasComponent() || e.HasComponent()) { ImGui::PopStyleColor(); @@ -1019,12 +1019,15 @@ namespace Nuake { ImGui::PopStyleColor(); } - if (!isPrefab && open) + if (open) { - // Caching list to prevent deletion while iterating. - std::vector childrens = parent.Children; - for (auto& c : childrens) - DrawEntityTree(c); + if (!isPrefab) + { + // Caching list to prevent deletion while iterating. + std::vector childrens = parent.Children; + for (auto& c : childrens) + DrawEntityTree(c); + } ImGui::TreePop(); }