diff --git a/Editor/src/Windows/EditorInterface.cpp b/Editor/src/Windows/EditorInterface.cpp index 7c993e65..2c2d8f25 100644 --- a/Editor/src/Windows/EditorInterface.cpp +++ b/Editor/src/Windows/EditorInterface.cpp @@ -402,8 +402,18 @@ namespace Nuake { { Ref newPrefab = Prefab::CreatePrefabFromEntity(Selection.Entity); std::string savePath = FileDialog::SaveFile("*.prefab"); - newPrefab->SaveAs(savePath); - Selection.Entity.AddComponent().PrefabInstance = newPrefab; + if (!String::EndsWith(savePath, ".prefab")) + { + savePath += ".prefab"; + } + + if (!savePath.empty()) + { + newPrefab->SaveAs(savePath); + Selection.Entity.AddComponent().PrefabInstance = newPrefab; + FileSystem::Scan(); + FileSystemUI::m_CurrentDirectory = FileSystem::RootDirectory; + } } ImGui::EndPopup(); } diff --git a/Editor/src/Windows/FileSystemUI.cpp b/Editor/src/Windows/FileSystemUI.cpp index 55d690ef..181ddf97 100644 --- a/Editor/src/Windows/FileSystemUI.cpp +++ b/Editor/src/Windows/FileSystemUI.cpp @@ -247,7 +247,7 @@ namespace Nuake path += ".material"; } - if (path != "") + if (!path.empty()) { Ref material = CreateRef(); material->IsEmbedded = false;