From ba204029009c04f31f862975e8c31d5d2a77ec5e Mon Sep 17 00:00:00 2001 From: Ruan Lucas <79365912+RuanLucasGD@users.noreply.github.com> Date: Thu, 28 Sep 2023 19:05:26 -0400 Subject: [PATCH] Change OnDestroy order --- Source/Engine/Level/Actor.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Source/Engine/Level/Actor.cpp b/Source/Engine/Level/Actor.cpp index 5d4cd9495..f89083177 100644 --- a/Source/Engine/Level/Actor.cpp +++ b/Source/Engine/Level/Actor.cpp @@ -877,6 +877,12 @@ void Actor::EndPlay() #endif // Fire event for scripting + if (IsActiveInHierarchy() && GetScene()) + { + ASSERT(GetScene()); + OnDisable(); + } + for (auto* script : Scripts) { CHECK_EXECUTE_IN_EDITOR @@ -885,13 +891,6 @@ void Actor::EndPlay() } } - // Fire event for scripting - if (IsActiveInHierarchy() && GetScene()) - { - ASSERT(GetScene()); - OnDisable(); - } - OnEndPlay(); // Clear flag