This commit is contained in:
Ruan Lucas
2023-09-24 11:28:07 -04:00
parent 248304a78f
commit 409b17df2d

View File

@@ -876,6 +876,15 @@ void Actor::EndPlay()
CHECK(IsDuringPlay());
#endif
// Fire event for scripting
for (auto* script : Scripts)
{
CHECK_EXECUTE_IN_EDITOR
{
script->OnDestroy();
}
}
// Fire event for scripting
if (IsActiveInHierarchy() && GetScene())
{
@@ -895,15 +904,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++)
{