MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / WipeOutLeftoverSceneObjects

Method WipeOutLeftoverSceneObjects

Source/Editor/Managed/ManagedEditor.cpp:602–629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

600}
601
602void 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
631Array<Window*> ManagedEditor::GetWindows()
632{

Callers 1

OnExitMethod · 0.80

Calls 10

EnumHasAllFlagsFunction · 0.85
EnumHasNoneFlagsFunction · 0.85
GetNamePathMethod · 0.80
GetIDMethod · 0.80
DeleteObjectMethod · 0.80
FlushFunction · 0.50
GetParentMethod · 0.45
HasTagMethod · 0.45
ToStringMethod · 0.45
GetTypeMethod · 0.45

Tested by

no test coverage detected