fixing crash when opening different level during simulation mode (#6762)
Signed-off-by: Mikhail Naumov <mnaumov@amazon.com>
This commit is contained in:
@@ -3363,6 +3363,10 @@ CCryEditDoc* CCryEditApp::OpenDocumentFile(const char* filename, bool addToMostR
|
||||
return GetIEditor()->GetDocument();
|
||||
}
|
||||
|
||||
bool usePrefabSystemForLevels = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled);
|
||||
|
||||
// If we are loading and we're in simulate mode, then switch it off before we do anything else
|
||||
if (GetIEditor()->GetGameEngine() && GetIEditor()->GetGameEngine()->GetSimulationMode())
|
||||
{
|
||||
@@ -3370,6 +3374,15 @@ CCryEditDoc* CCryEditApp::OpenDocumentFile(const char* filename, bool addToMostR
|
||||
bool bIsDocModified = GetIEditor()->GetDocument()->IsModified();
|
||||
OnSwitchPhysics();
|
||||
GetIEditor()->GetDocument()->SetModifiedFlag(bIsDocModified);
|
||||
|
||||
if (usePrefabSystemForLevels)
|
||||
{
|
||||
auto* rootSpawnableInterface = AzFramework::RootSpawnableInterface::Get();
|
||||
if (rootSpawnableInterface)
|
||||
{
|
||||
rootSpawnableInterface->ProcessSpawnableQueue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We're about to start loading a level, so start recording errors to display at the end.
|
||||
|
||||
Reference in New Issue
Block a user