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

Function OnSceneUnloading

Source/Engine/Navigation/NavMeshBuilder.cpp:804–837  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

802}
803
804void OnSceneUnloading(Scene* scene, const Guid& sceneId)
805{
806 // Cancel pending build requests
807 NavBuildQueueLocker.Lock();
808 for (int32 i = 0; i < NavBuildQueue.Count(); i++)
809 {
810 if (NavBuildQueue[i].Scene == scene)
811 {
812 NavBuildQueue.RemoveAtKeepOrder(i);
813 break;
814 }
815 }
816 NavBuildQueueLocker.Unlock();
817
818 // Cancel active build tasks
819 NavBuildTasksLocker.Lock();
820 for (int32 i = 0; i < NavBuildTasks.Count(); i++)
821 {
822 auto task = NavBuildTasks[i];
823 if (task->Scene == scene)
824 {
825 NavBuildTasksLocker.Unlock();
826
827 // Cancel task but without locking queue from this thread to prevent deadlocks
828 task->Cancel();
829
830 NavBuildTasksLocker.Lock();
831 i--;
832 if (NavBuildTasks.IsEmpty())
833 break;
834 }
835 }
836 NavBuildTasksLocker.Unlock();
837}
838
839void NavMeshBuilder::Init()
840{

Callers

nothing calls this directly

Calls 6

LockMethod · 0.80
RemoveAtKeepOrderMethod · 0.80
UnlockMethod · 0.80
CountMethod · 0.45
CancelMethod · 0.45
IsEmptyMethod · 0.45

Tested by

no test coverage detected