From b33e9a3f7a1d7ca09a2a04c41c3e609e1c8ca3ba Mon Sep 17 00:00:00 2001 From: Angel Pons <22937129+Th3Fanbus@users.noreply.github.com> Date: Sat, 6 Apr 2024 09:47:00 +0000 Subject: [PATCH] fix: Only update abstract instances in game worlds When trying to set up abstract instances, compiling the blueprint makes the editor crash. According to Ben from CSS, the abstract instance code in question should not run during compile. So, only update the abstract instances in game worlds. --- CustomImplementations/Buildables/FGBuildable.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CustomImplementations/Buildables/FGBuildable.cpp b/CustomImplementations/Buildables/FGBuildable.cpp index e6892b9c..5ffde8ec 100644 --- a/CustomImplementations/Buildables/FGBuildable.cpp +++ b/CustomImplementations/Buildables/FGBuildable.cpp @@ -26,9 +26,13 @@ void AFGBuildable::OnConstruction(const FTransform& transform) { Super::OnConstruction(transform); #if WITH_EDITOR - RemoveInstances(); - RemoveInstances_Native(); - CallSetupInstances(); + const UWorld* World = GetWorld(); + if (IsValid(World) and World->IsGameWorld()) { + // Don't do this for non-game worlds, otherwise the editor crashes when compiling a blueprint + RemoveInstances(); + RemoveInstances_Native(); + CallSetupInstances(); + } #endif } TArray AFGBuildable::GetActorLightweightInstanceData_Implementation() {