浏览代码

ASV: fix ME crash by checking for game type instead of editor

Signed-off-by: Guthrie Adams <[email protected]>
Guthrie Adams 4 年之前
父节点
当前提交
9feb8ae2f9
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      Gem/Code/Source/SampleComponentManager.cpp

+ 5 - 1
Gem/Code/Source/SampleComponentManager.cpp

@@ -318,7 +318,7 @@ namespace AtomSampleViewer
 
 
         AZ::ApplicationTypeQuery appType;
         AZ::ApplicationTypeQuery appType;
         ComponentApplicationBus::Broadcast(&AZ::ComponentApplicationBus::Events::QueryApplicationType, appType);
         ComponentApplicationBus::Broadcast(&AZ::ComponentApplicationBus::Events::QueryApplicationType, appType);
-        if (!appType.IsValid() || appType.IsEditor())
+        if (!appType.IsValid() || !appType.IsGame())
         {
         {
             return;
             return;
         }
         }
@@ -446,6 +446,10 @@ namespace AtomSampleViewer
 
 
     void SampleComponentManager::Deactivate()
     void SampleComponentManager::Deactivate()
     {
     {
+        AzFramework::EntityContextRequestBus::Event(
+            m_entityContextId, &AzFramework::EntityContextRequestBus::Events::DestroyEntity, m_cameraEntity);
+        m_cameraEntity = nullptr;
+
         AzFramework::AssetCatalogEventBus::Handler::BusDisconnect();
         AzFramework::AssetCatalogEventBus::Handler::BusDisconnect();
         AZ::Render::ImGuiSystemNotificationBus::Handler::BusDisconnect();
         AZ::Render::ImGuiSystemNotificationBus::Handler::BusDisconnect();
         m_scriptManager->Deactivate();
         m_scriptManager->Deactivate();