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

Method OnBeginPlay

Source/Engine/Level/Level.cpp:1392–1414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1390}
1391
1392SceneResult SceneLoader::OnBeginPlay(Args& args)
1393{
1394 PROFILE_CPU_NAMED("BeginPlay");
1395 ASSERT_LOW_LAYER(IsInMainThread());
1396
1397 // Link scene
1398 ScopeLock lock(Level::ScenesLock);
1399 Level::Scenes.Add(Scene);
1400
1401 // TODO: prototype time-slicing with load-balancing for Begin Play:
1402 // TODO: - collect all actors to enable
1403 // TODO: - invoke in order OnBeginPlay -> Child Actors Begin -> Child Scripts Begin -> OnEnable for each actor
1404 // TODO: - consider not drawing level until it's fully loaded (other engine systems should respect this too?)
1405 // TODO: - consider refactoring Joints creation maybe? to get rid of SceneBeginData
1406
1407 // Start the game for scene objects
1408 SceneBeginData beginData;
1409 Scene->BeginPlay(&beginData);
1410 beginData.OnDone();
1411
1412 NextStage();
1413 return SceneResult::Success;
1414}
1415
1416SceneResult SceneLoader::OnEnd(Args& args)
1417{

Callers

nothing calls this directly

Calls 4

IsInMainThreadFunction · 0.85
OnDoneMethod · 0.80
AddMethod · 0.45
BeginPlayMethod · 0.45

Tested by

no test coverage detected