void UUserWidget::NativeTick(const FGeometry& MyGeometry, float InDeltaTime) { GInitRunaway(); TickActionsAndAnimation(MyGeometry, InDeltaTime); Tick(MyGeometry, InDeltaTime); }
/** * Update the level after a variable amount of time, DeltaSeconds, has passed. * All child actors are ticked after their owners have been ticked. */ void UWorld::Tick( ELevelTick TickType, float DeltaSeconds ) { if (GIntraFrameDebuggingGameThread) { return; } #if LOG_DETAILED_PATHFINDING_STATS GDetailedPathFindingStats.Reset(); #endif SCOPE_CYCLE_COUNTER(STAT_WorldTickTime); #if ENABLE_COLLISION_ANALYZER // Tick collision analyzer (only if level is really ticking) if(TickType == LEVELTICK_All || TickType == LEVELTICK_ViewportsOnly) { ICollisionAnalyzer* Analyzer = FCollisionAnalyzerModule::Get(); Analyzer->TickAnalyzer(this); GCollisionAnalyzerIsRecording = Analyzer->IsRecording(); } #endif // ENABLE_COLLISION_ANALYZER AWorldSettings* Info = GetWorldSettings(); FMemMark Mark(FMemStack::Get()); GInitRunaway(); bInTick=true; bool bIsPaused = IsPaused(); { SCOPE_CYCLE_COUNTER(STAT_NetWorldTickTime); // Update the net code and fetch all incoming packets. BroadcastTickDispatch(DeltaSeconds); if( NetDriver && NetDriver->ServerConnection ) { TickNetClient( DeltaSeconds ); } } // Update time. RealTimeSeconds += DeltaSeconds; // Audio always plays at real-time regardless of time dilation, but only when NOT paused if( !bIsPaused ) { AudioTimeSeconds += DeltaSeconds; } // Save off actual delta float RealDeltaSeconds = DeltaSeconds; // apply time multipliers DeltaSeconds *= Info->GetEffectiveTimeDilation(); // Clamp time between 2000 fps and 2.5 fps. DeltaSeconds = FMath::Clamp(DeltaSeconds,0.0005f,0.40f); DeltaTimeSeconds = DeltaSeconds; if ( !bIsPaused ) { TimeSeconds += DeltaSeconds; } if( bPlayersOnly ) { TickType = LEVELTICK_ViewportsOnly; } // give the async loading code more time if we're performing a high priority load or are in seamless travel if (Info->bHighPriorityLoading || Info->bHighPriorityLoadingLocal || IsInSeamlessTravel()) { // Force it to use the entire time slice, even if blocked on I/O ProcessAsyncLoading(true, true, GEngine->PriorityAsyncLoadingExtraTime / 1000.0f); } // Translate world origin if requested if (OriginLocation != RequestedOriginLocation) { SetNewWorldOrigin(RequestedOriginLocation); bOriginOffsetThisFrame = true; } else { bOriginOffsetThisFrame = false; } // update world's subsystems (NavigationSystem for now) if ( !bIsPaused ) { if (NavigationSystem != NULL) { SCOPE_CYCLE_COUNTER(STAT_NavWorldTickTime); NavigationSystem->Tick(DeltaSeconds); } } bool bDoingActorTicks = (TickType!=LEVELTICK_TimeOnly) && !bIsPaused && (!NetDriver || !NetDriver->ServerConnection || NetDriver->ServerConnection->State==USOCK_Open); // Reset the list of objects the LatentActionManager has processed this frame LatentActionManager.BeginFrame(); // If caller wants time update only, or we are paused, skip the rest. if (bDoingActorTicks) { // Reset Async Trace before Tick starts { SCOPE_CYCLE_COUNTER(STAT_ResetAsyncTraceTickTime); ResetAsyncTrace(); } SetupPhysicsTickFunctions(DeltaSeconds); TickGroup = TG_PrePhysics; // reset this to the start tick group FTickTaskManagerInterface::Get().StartFrame(this, DeltaSeconds, TickType); /////////////////// // There is an opportunity for the game thread to do a ms or two of work here "for free" while the tick scheduling proceeds on other cores. // We can run any code that doesn't affect the registration, enabled state lifetime or basically anything else relating to any FTickFunction SCOPE_CYCLE_COUNTER(STAT_TickTime); RunTickGroup(TG_PrePhysics); bInTick = false; EnsureCollisionTreeIsBuilt(); bInTick = true; RunTickGroup(TG_StartPhysics); RunTickGroup(TG_DuringPhysics, false); // No wait here, we should run until idle though. We don't care if all of the async ticks are done before we start running post-phys stuff TickGroup = TG_EndPhysics; // set this here so the current tick group is correct during collision notifies, though I am not sure it matters. 'cause of the false up there^^^ RunTickGroup(TG_EndPhysics); if ( PhysicsScene != NULL ) { PhysicsScene->DeferredCommandHandler.Flush(); } RunTickGroup(TG_PreCloth); RunTickGroup(TG_StartCloth); RunTickGroup(TG_EndCloth); RunTickGroup(TG_PostPhysics); } else if( bIsPaused ) { FTickTaskManagerInterface::Get().RunPauseFrame(this, DeltaSeconds, LEVELTICK_PauseTick); } // Process any remaining latent actions if( !bIsPaused ) { // This will process any latent actions that have not been processed already LatentActionManager.ProcessLatentActions( NULL, DeltaSeconds ); } #if 0 // if you need to debug physics drawing in editor, use this. If you type pxvis collision, it will work. else { // Tick our async work (physics, etc.) and tick with no elapsed time for playersonly TickAsyncWork(0.f); // Wait for async work to come back WaitForAsyncWork(); } #endif { SCOPE_CYCLE_COUNTER(STAT_TickableTickTime); if (TickType != LEVELTICK_TimeOnly && !bIsPaused) { STAT(FScopeCycleCounter Context(TimerManager->GetStatId());) TimerManager->Tick(DeltaSeconds); }
void USuperLoopLibrary::ResetRunawayLoopCounter() { // Reset the runaway loop counter to 0. GInitRunaway(); }