Browse Source

Fixed debug draw application when Editor preview is enabled

Signed-off-by: Olex Lozitskiy <[email protected]>
Olex Lozitskiy 3 years ago
parent
commit
6d97f7c85d

+ 9 - 0
Gems/RecastNavigation/Code/Source/EditorComponents/EditorRecastNavigationMeshComponent.cpp

@@ -189,6 +189,15 @@ namespace RecastNavigation
         BaseClass::Deactivate();
     }
 
+    void EditorRecastNavigationMeshComponent::BuildGameEntity(AZ::Entity* gameEntity)
+    {
+        const bool saveState = m_controller.m_configuration.m_enableEditorPreview;
+        m_controller.m_configuration.m_enableEditorPreview = false;
+        // The game entity must query the regular game PhysX scene, while the Editor component must query the Editor PhysX scene.
+        BaseClass::BuildGameEntity(gameEntity);
+        m_controller.m_configuration.m_enableEditorPreview = saveState;
+    }
+
     AZ::u32 EditorRecastNavigationMeshComponent::OnConfigurationChanged()
     {
         m_controller.CreateNavigationMesh(GetEntityId());

+ 2 - 0
Gems/RecastNavigation/Code/Source/EditorComponents/EditorRecastNavigationMeshComponent.h

@@ -34,6 +34,8 @@ namespace RecastNavigation
         void Activate() override;
         void Deactivate() override;
 
+        void BuildGameEntity(AZ::Entity* gameEntity) override;
+
         //! Enables or disables in-Editor preview of navigation mesh without entering game mode.
         //! @param enable if true, the preview will be enabled
         void SetEditorPreview(bool enable);