From c0b35affa6e75086ac393f01312f07edcb232c2a Mon Sep 17 00:00:00 2001 From: BenPyton Date: Wed, 6 Mar 2024 12:26:00 +0100 Subject: [PATCH] Fixed update of occlusion when settings are changed during runtime in packaged game --- Source/ProceduralDungeon/Private/DungeonGenerator.cpp | 3 +-- Source/ProceduralDungeon/Public/DungeonGenerator.h | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Source/ProceduralDungeon/Private/DungeonGenerator.cpp b/Source/ProceduralDungeon/Private/DungeonGenerator.cpp index 49333a5..527c614 100644 --- a/Source/ProceduralDungeon/Private/DungeonGenerator.cpp +++ b/Source/ProceduralDungeon/Private/DungeonGenerator.cpp @@ -399,7 +399,7 @@ void ADungeonGenerator::UpdateRoomVisibility() const bool bIsOcclusionEnabled = Dungeon::OcclusionCulling(); const uint32 OcclusionDistance = Dungeon::OcclusionDistance(); -#if WITH_EDITOR + // Detects occlusion setting changes and toggles on/off all room visibilities when occlusion is enabled/disabled. if (bWasOcclusionEnabled != bIsOcclusionEnabled || PreviousOcclusionDistance != OcclusionDistance) @@ -412,7 +412,6 @@ void ADungeonGenerator::UpdateRoomVisibility() } bWasOcclusionEnabled = bIsOcclusionEnabled; PreviousOcclusionDistance = OcclusionDistance; -#endif // Don't change room visibilities if occlusion is disabled. if (!bIsOcclusionEnabled) diff --git a/Source/ProceduralDungeon/Public/DungeonGenerator.h b/Source/ProceduralDungeon/Public/DungeonGenerator.h index 7f71c83..877479b 100644 --- a/Source/ProceduralDungeon/Public/DungeonGenerator.h +++ b/Source/ProceduralDungeon/Public/DungeonGenerator.h @@ -300,11 +300,9 @@ class PROCEDURALDUNGEON_API ADungeonGenerator : public AActor TUniquePtr Octree; TSet CurrentPlayerRooms; -#if WITH_EDITOR // Transient. Only used to detect when occlusion setting is changed. bool bWasOcclusionEnabled {false}; // Transient. Only used to detect when occlusion distance is changed. uint32 PreviousOcclusionDistance {0}; -#endif };