diff --git a/Source/Engine/Level/Actor.cpp b/Source/Engine/Level/Actor.cpp index 394d5c9dc..f89083177 100644 --- a/Source/Engine/Level/Actor.cpp +++ b/Source/Engine/Level/Actor.cpp @@ -883,6 +883,14 @@ void Actor::EndPlay() OnDisable(); } + for (auto* script : Scripts) + { + CHECK_EXECUTE_IN_EDITOR + { + script->OnDestroy(); + } + } + OnEndPlay(); // Clear flag @@ -895,15 +903,6 @@ void Actor::EndPlay() Children[i]->EndPlay(); } - // Fire event for scripting - for (auto* script : Scripts) - { - CHECK_EXECUTE_IN_EDITOR - { - script->OnDestroy(); - } - } - // Inform attached scripts for (int32 i = 0; i < Scripts.Count(); i++) {