diff --git a/Editor/src/Windows/EditorInterface.cpp b/Editor/src/Windows/EditorInterface.cpp index da146dd4..96963f60 100644 --- a/Editor/src/Windows/EditorInterface.cpp +++ b/Editor/src/Windows/EditorInterface.cpp @@ -856,6 +856,7 @@ namespace Nuake { } bool isDragging = false; + bool isPrefab = e.HasComponent(); if (nameComponent.IsPrefab && e.HasComponent() || e.HasComponent()) { ImGui::PopStyleColor(); @@ -867,7 +868,7 @@ namespace Nuake { ImGui::EndDragDropSource(); } - if (ImGui::BeginDragDropTarget()) + if (!isPrefab && ImGui::BeginDragDropTarget()) { if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("ENTITY")) { @@ -907,7 +908,6 @@ namespace Nuake { } ImGui::EndDragDropTarget(); } - if (!isDragging && ImGui::IsItemHovered() && ImGui::IsMouseReleased(0)) { @@ -964,7 +964,7 @@ namespace Nuake { } } - if (ImGui::Selectable("Save entity as a new prefab")) + if (!isPrefab && ImGui::Selectable("Save entity as a new prefab")) { Ref newPrefab = Prefab::CreatePrefabFromEntity(Selection.Entity); std::string savePath = FileDialog::SaveFile("*.prefab"); @@ -1019,7 +1019,7 @@ namespace Nuake { ImGui::PopStyleColor(); } - if (open) + if (!isPrefab && open) { // Caching list to prevent deletion while iterating. std::vector childrens = parent.Children; @@ -3430,6 +3430,7 @@ namespace Nuake { if (entity.HasComponent()) { entityTypeName = "Prefab"; + return entityTypeName; } if (entity.HasComponent())