NiagaraDebugHud
NiagaraDebugHud
#Overview
name: NiagaraDebugHud
This variable is created as a Console Variable (cvar).
- type:
Cmd
- help:
Shorter version to quickly toggle debug hud modes\n No value will toggle the overview on / off\n A numberic value selects which overmode to set, where 0 is off\n
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of NiagaraDebugHud is to provide a debugging and visualization tool for the Niagara visual effects system in Unreal Engine 5. It allows developers to view and analyze real-time information about Niagara systems and their performance.
This setting variable is primarily used by the Niagara plugin, which is part of Unreal Engine’s visual effects subsystem. Based on the callsites, it’s clear that the NiagaraWorldManager class is the main component that interacts with and manages the NiagaraDebugHud.
The value of this variable is set in the FNiagaraWorldManager::Init function, where a new FNiagaraDebugHud object is created and assigned to the NiagaraDebugHud unique pointer.
NiagaraDebugHud interacts with other components of the Niagara system, particularly the NiagaraWorldManager. It’s used to gather system information in the PostActorTick function of NiagaraWorldManager.
Developers should be aware that:
- The NiagaraDebugHud is only available when WITH_NIAGARA_DEBUGGER is defined, indicating it’s a debugging feature that may not be present in all builds.
- It’s accessed through the NiagaraWorldManager, which suggests it operates on a per-world basis.
- There’s a console command “NiagaraDebugHud” that can be used to toggle and control the debug HUD modes.
Best practices when using this variable include:
- Use it primarily for debugging and performance analysis, not for gameplay-critical features.
- Be mindful of its performance impact, especially when gathering system info in the PostActorTick function.
- Utilize the console command for quick toggles and mode changes during development and testing.
- Remember to disable or remove debug-related code in release builds to optimize performance.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraDebugHud.cpp:168
Scope (from outer to inner):
file
namespace NiagaraDebugLocal
Source code excerpt:
static FAutoConsoleCommandWithWorldAndArgs CmdNiagaraDebugHud(
TEXT("NiagaraDebugHud"),
TEXT("Shorter version to quickly toggle debug hud modes\n")
TEXT(" No value will toggle the overview on / off\n")
TEXT(" A numberic value selects which overmode to set, where 0 is off\n"),
FConsoleCommandWithWorldAndArgsDelegate::CreateLambda(
[](const TArray<FString>& Args, UWorld*)
{
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraWorldManager.cpp:402
Scope (from outer to inner):
file
function void FNiagaraWorldManager::Init
Source code excerpt:
#if WITH_NIAGARA_DEBUGGER
NiagaraDebugHud.Reset(new FNiagaraDebugHud(World));
#endif
#if WITH_NIAGARA_LEAK_DETECTOR
if ( World->IsGameWorld() )
{
ComponentLeakDetector.Reset(new FNiagaraComponentLeakDetector());
}
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraWorldManager.cpp:1111
Scope (from outer to inner):
file
function void FNiagaraWorldManager::PostActorTick
Source code excerpt:
#if WITH_NIAGARA_DEBUGGER
// Tick debug HUD for the world
if (NiagaraDebugHud != nullptr)
{
QUICK_SCOPE_CYCLE_COUNTER(STAT_NiagaraDebugHUD);
NiagaraDebugHud->GatherSystemInfo();
}
#endif
if ( DebugPlaybackMode == ENiagaraDebugPlaybackMode::Step )
{
RequestedDebugPlaybackMode = ENiagaraDebugPlaybackMode::Paused;
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Public/NiagaraWorldManager.h:228
Scope (from outer to inner):
file
class class FNiagaraWorldManager : public FGCObject
function class FNiagaraDebugHud* GetNiagaraDebugHud
Source code excerpt:
#if WITH_NIAGARA_DEBUGGER
class FNiagaraDebugHud* GetNiagaraDebugHud() { return NiagaraDebugHud.Get(); }
#endif
class FNiagaraDeferredMethodQueue& GetDeferredMethodQueue() { return DeferredMethods; }
/**
Flush the compute simulation queue and any deferred actions.
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Public/NiagaraWorldManager.h:411
Scope (from outer to inner):
file
class class FNiagaraWorldManager : public FGCObject
Source code excerpt:
#if WITH_NIAGARA_DEBUGGER
TUniquePtr<class FNiagaraDebugHud> NiagaraDebugHud;
#endif
#if WITH_NIAGARA_LEAK_DETECTOR
TUniquePtr<class FNiagaraComponentLeakDetector> ComponentLeakDetector;
#endif
TMap<TObjectPtr<UNiagaraSystem>, TObjectPtr<UNiagaraCullProxyComponent>> CullProxyMap;