voidAActor::DispatchBeginPlay(bool bFromLevelStreaming){
UWorld* World =(!HasActorBegunPlay()&&!IsPendingKill()?GetWorld():nullptr);if(World){ensureMsgf(ActorHasBegunPlay == EActorBeginPlayState::HasNotBegunPlay,TEXT("BeginPlay was called on actor %s which was in state %d"),*GetPathName(),(int32)ActorHasBegunPlay);const uint32 CurrentCallDepth = BeginPlayCallDepth++;
bActorBeginningPlayFromLevelStreaming = bFromLevelStreaming;
ActorHasBegunPlay = EActorBeginPlayState::BeginningPlay;BeginPlay();ensure(BeginPlayCallDepth -1== CurrentCallDepth);
BeginPlayCallDepth = CurrentCallDepth;if(bActorWantsDestroyDuringBeginPlay){// Pass true for bNetForce as either it doesn't matter or it was true the first time to even // get to the point we set bActorWantsDestroyDuringBeginPlay to true
World->DestroyActor(this,true);}if(!IsPendingKill()){// Initialize overlap stateUpdateInitialOverlaps(bFromLevelStreaming);}
bActorBeginningPlayFromLevelStreaming =false;}}