fx.Niagara.Debug.KillSpawned
fx.Niagara.Debug.KillSpawned
#Overview
name: fx.Niagara.Debug.KillSpawned
This variable is created as a Console Variable (cvar).
- type:
Cmd
- help:
Kills all spawned compoonents
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of fx.Niagara.Debug.KillSpawned is to kill all spawned Niagara components in the game world for debugging purposes. This setting variable is part of the Niagara visual effects system in Unreal Engine 5.
This setting variable is primarily used by the Niagara plugin, specifically within the debug and editor modules. It’s referenced in both the core Niagara module (NiagaraDebugHud.cpp) and the NiagaraEditor module (SNiagaraDebuggerSpawn.cpp).
The value of this variable is not set directly in the provided code snippets. Instead, it’s used as a console command that can be executed to perform the kill action on spawned components.
This variable interacts with other debug-related variables and functions in the Niagara system, particularly those related to spawning and managing Niagara components for debugging purposes.
Developers must be aware that using this command will remove all Niagara components that were spawned for debugging. It’s a powerful tool that can significantly alter the state of the game world, so it should be used carefully.
Best practices when using this variable include:
- Use it in conjunction with other Niagara debugging tools to manage the lifecycle of debug components.
- Ensure it’s only called in appropriate debug contexts to avoid accidentally removing important visual effects.
- Consider using it before spawning new debug components to maintain a clean debugging environment.
- Be aware of its impact on performance and visual state when used in editor tools or runtime debugging scenarios.
#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:319
Scope (from outer to inner):
file
namespace NiagaraDebugLocal
Source code excerpt:
static FAutoConsoleCommandWithWorldAndArgs CmdSpawnSystem(
TEXT("fx.Niagara.Debug.KillSpawned"),
TEXT("Kills all spawned compoonents"),
FConsoleCommandWithWorldAndArgsDelegate::CreateLambda(
[](const TArray<FString>& Args, UWorld* World)
{
for (TWeakObjectPtr<UNiagaraComponent> WeakComponent : GDebugSpawnedComponents)
{
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/Widgets/SNiagaraDebuggerSpawn.cpp:115
Scope (from outer to inner):
file
function void SNiagaraDebuggerSpawn::KillExisting
Source code excerpt:
return;
}
Debugger->ExecConsoleCommand(TEXT("fx.Niagara.Debug.KillSpawned"), true);
SystemsToSpwan.Empty();
}
bool SNiagaraDebuggerSpawn::CanSpawnFromTextFile() const
{
return Debugger.IsValid() && SystemsToSpwan.Num() == 0;
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/Widgets/SNiagaraDebuggerSpawn.cpp:203
Scope (from outer to inner):
file
function void SNiagaraDebuggerSpawn::Tick
Source code excerpt:
if (bKillBeforeSpawn)
{
Debugger->ExecConsoleCommand(TEXT("fx.Niagara.Debug.KillSpawned"), true);
}
for ( const FString& SystemName : SystemsToSpwan )
{
FString Cmd = FString::Printf(TEXT("fx.Niagara.Debug.SpawnComponent %s %s"), *SystemsToSpwan[0], *SpawnCommandArgs);
Debugger->ExecConsoleCommand(*Cmd, true);
}
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/Widgets/SNiagaraDebuggerSpawn.cpp:221
Scope (from outer to inner):
file
function void SNiagaraDebuggerSpawn::Tick
Source code excerpt:
if (bKillBeforeSpawn)
{
Debugger->ExecConsoleCommand(TEXT("fx.Niagara.Debug.KillSpawned"), true);
}
FString Cmd = FString::Printf(TEXT("fx.Niagara.Debug.SpawnComponent %s %s"), *SystemsToSpwan[0], *SpawnCommandArgs);
Debugger->ExecConsoleCommand(*Cmd, true);
SystemsToSpwan.RemoveAt(0);