Fix crash when saving an existing already saved map containing a dirty landscape using Save As.. to rename it.

#rb
#jira UE-166224
#preflight 6346fa2cf04e6f85051afe87

[CL 22487807 by chris tchou in ue5-main branch]
This commit is contained in:
chris tchou
2022-10-12 19:00:27 -04:00
parent fd33c4c481
commit 9dbd6ae2bb
2 changed files with 8 additions and 0 deletions

View File

@@ -90,6 +90,13 @@ ETickableTickType ULandscapeSubsystem::GetTickableTickType() const
return HasAnyFlags(RF_ClassDefaultObject) || !GetWorld() || GetWorld()->IsNetMode(NM_DedicatedServer) ? ETickableTickType::Never : ETickableTickType::Always;
}
bool ULandscapeSubsystem::DoesSupportWorldType(const EWorldType::Type WorldType) const
{
// we also support inactive worlds -- they are used when the world is already saved, but SaveAs renames it:
// then it duplicates the world (producing an inactive world), which we then need to update Landscapes in during OnPreSave()
return Super::DoesSupportWorldType(WorldType) || WorldType == EWorldType::Inactive;
}
void ULandscapeSubsystem::Tick(float DeltaTime)
{
SCOPE_CYCLE_COUNTER(STAT_LandscapeSubsystemTick);

View File

@@ -46,6 +46,7 @@ public:
virtual void Tick(float DeltaTime) override;
virtual bool IsTickableInEditor() const override { return true; }
virtual ETickableTickType GetTickableTickType() const override;
virtual bool DoesSupportWorldType(const EWorldType::Type WorldType) const override;
virtual TStatId GetStatId() const override;
// End FTickableGameObject overrides