fx.Niagara.Debug.GlobalLoopTime

fx.Niagara.Debug.GlobalLoopTime

#Overview

name: fx.Niagara.Debug.GlobalLoopTime

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of fx.Niagara.Debug.GlobalLoopTime is to control the looping behavior of Niagara FX systems in Unreal Engine 5. This setting variable is primarily used for debugging and testing purposes within the Niagara visual effects system.

This setting variable is relied upon by the Niagara plugin, specifically within the NiagaraWorldManager, NiagaraComponent, and NiagaraDebugHud modules.

The value of this variable is set through a console command or can be modified at runtime. It is defined as an FAutoConsoleVariableRef, which allows it to be easily accessed and modified through the console or code.

The variable interacts with other Niagara-related systems, particularly the NiagaraWorldManager and NiagaraComponent. It also affects the debug HUD display for Niagara effects.

Developers must be aware that when this variable is set to a value greater than 0, all Niagara FX will reset every N seconds, where N is the value set. This can significantly alter the behavior of particle systems and should be used carefully, primarily for debugging purposes.

Best practices when using this variable include:

  1. Use it temporarily for debugging and testing, not in production builds.
  2. Be aware that it affects all Niagara FX globally, which may have unintended consequences.
  3. Reset the value to 0 when not actively debugging to ensure normal Niagara FX behavior.
  4. Consider using it in conjunction with other Niagara debugging tools for comprehensive testing.
  5. Document its usage clearly when incorporating it into debugging workflows to prevent confusion among team members.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraWorldManager.cpp:147

Scope: file

Source code excerpt:

float GWorldLoopTime = 0.0f;
static FAutoConsoleVariableRef CVarWorldLoopTime(
	TEXT("fx.Niagara.Debug.GlobalLoopTime"),
	GWorldLoopTime,
	TEXT("If > 0 all Niagara FX will reset every N seconds. \n"),
	ECVF_Default
);

int GNiagaraAllowCullProxies = 1;

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraComponent.cpp:1681

Scope (from outer to inner):

file
function     void UNiagaraComponent::OnSystemComplete

Source code excerpt:

			{
				// If we have a loop time set the WorldManager will force a reset, so we will just ignore the completion event in that case
				static const auto CVarGlobalLoopTime = IConsoleManager::Get().FindConsoleVariable(TEXT("fx.Niagara.Debug.GlobalLoopTime"));
				if (CVarGlobalLoopTime && (CVarGlobalLoopTime->GetFloat() <= 0.0f))
				{
					Activate(true);
				}
				return;
			}

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraDebugHud.cpp:1917

Scope (from outer to inner):

file
function     void FNiagaraDebugHud::DrawOverview

Source code excerpt:

		TStringBuilder<1024> OverviewString;
		{
			static const auto CVarGlobalLoopTime = IConsoleManager::Get().FindConsoleVariable(TEXT("fx.Niagara.Debug.GlobalLoopTime"));

			const TCHAR* Separator = TEXT("    ");
			const ENiagaraDebugPlaybackMode PlaybackMode = WorldManager->GetDebugPlaybackMode();
			const float PlaybackRate = WorldManager->GetDebugPlaybackRate();
			const float PlaybackLoopTime = CVarGlobalLoopTime ? CVarGlobalLoopTime->GetFloat() : 0.0f;