Parcourir la source

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

Signed-off-by: Guthrie Adams <[email protected]>
Guthrie Adams il y a 4 ans
Parent
commit
9feb8ae2f9
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      Gem/Code/Source/SampleComponentManager.cpp

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

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