| 600 | } |
| 601 | |
| 602 | void ManagedEditor::WipeOutLeftoverSceneObjects() |
| 603 | { |
| 604 | PROFILE_CPU(); |
| 605 | Array<ScriptingObject*> objects = Scripting::GetObjects(); |
| 606 | bool removedAny = false; |
| 607 | for (ScriptingObject* object : objects) |
| 608 | { |
| 609 | if (EnumHasAllFlags(object->Flags, ObjectFlags::IsDuringPlay) && EnumHasNoneFlags(object->Flags, ObjectFlags::WasMarkedToDelete)) |
| 610 | { |
| 611 | if (auto* sceneObject = Cast<SceneObject>(object)) |
| 612 | { |
| 613 | if (sceneObject->HasParent()) |
| 614 | continue; // Skip sub-objects |
| 615 | auto* actor = Cast<Actor>(sceneObject); |
| 616 | if (!actor) |
| 617 | actor = sceneObject->GetParent(); |
| 618 | if (actor && actor->HasTag(TEXT("__EditorInternal"))) |
| 619 | continue; // Skip internal objects used by Editor (eg. EditorScene) |
| 620 | |
| 621 | LOG(Error, "Object '{}' (ID={}, Type={}) is still in memory after play end but should be destroyed (memory leak).", sceneObject->GetNamePath(), sceneObject->GetID(), sceneObject->GetType().ToString()); |
| 622 | sceneObject->DeleteObject(); |
| 623 | removedAny = true; |
| 624 | } |
| 625 | } |
| 626 | } |
| 627 | if (removedAny) |
| 628 | ObjectsRemovalService::Flush(); |
| 629 | } |
| 630 | |
| 631 | Array<Window*> ManagedEditor::GetWindows() |
| 632 | { |
no test coverage detected