Selaa lähdekoodia

Merge pull request #222 from aws-lumberyard-dev/Atom/guthadam/fix_material_editor_asv_crash

ASV: fix ME crash by checking for game type instead of editor
Guthrie Adams 4 vuotta sitten
vanhempi
commit
75dc0edf2d
1 muutettua tiedostoa jossa 5 lisäystä ja 1 poistoa
  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();