From 400fb14e7e8043f10a2cab7b84754627e0ac831e Mon Sep 17 00:00:00 2001 From: bosnichd Date: Mon, 10 May 2021 08:37:59 -0600 Subject: [PATCH] Fix for level export. (#656) Reproduced the issue where a newly exported level would not display anything when loaded in the editor, verified this change fixes it. Note that this is all related to the legacy level system, not the new prefab level system. --- Code/Sandbox/Editor/GameExporter.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Code/Sandbox/Editor/GameExporter.cpp b/Code/Sandbox/Editor/GameExporter.cpp index 31f3fafe84..1b42f75ba3 100644 --- a/Code/Sandbox/Editor/GameExporter.cpp +++ b/Code/Sandbox/Editor/GameExporter.cpp @@ -295,6 +295,17 @@ void CGameExporter::ExportLevelData(const QString& path, bool /*bExportMission*/ CCryMemFile fileAction; fileAction.Write(xmlDataAction.c_str(), xmlDataAction.length()); m_levelPak.m_pakFile.UpdateFile(levelDataActionFile.toUtf8().data(), fileAction); + + AZStd::vector entitySaveBuffer; + AZ::IO::ByteContainerStream > entitySaveStream(&entitySaveBuffer); + bool savedEntities = false; + EBUS_EVENT_RESULT(savedEntities, AzToolsFramework::EditorEntityContextRequestBus, SaveToStreamForGame, entitySaveStream, AZ::DataStream::ST_BINARY); + if (savedEntities) + { + QString entitiesFile; + entitiesFile = QStringLiteral("%1%2.entities_xml").arg(path, "Mission0"); + m_levelPak.m_pakFile.UpdateFile(entitiesFile.toUtf8().data(), entitySaveBuffer.begin(), entitySaveBuffer.size()); + } } //////////////////////////////////////////////////////////////////////////