Engine & Editor

Console window panel

You can have a cool panel with your console commands & variable in Window->Console Variables

Saving console variables

You can either:

  • use the console command window
  • set the console variable value in the correct .ini in the correct section
  • see ConsoleVariables.ini (special file that doesn’t exist by default, can be copied from source engine).
  • use a UDeveloperSettingsBackedByCvars
  • or simply add the cvar under [ConsoleVariables] section in the correct .ini file

List of existing commands and variables

Core

  • stat game
  • Object console commands list here
  • ShowDebug [Name], by default this will give details about the player pawn/character
  • ToggleDisplay : disables all HUD
    • See also Slate.GameLayer.ViewportSlotVisible 0 and Slate.GameLayer.PlayerCanvasVisible 0

Player

  • Teleport: teleports the player to the crosshair position

Miscs

  • slomo <new time dilation>: changes the world time dilation
  • listtimers: show all active/paused/pending times.

Rendering

See Debugging Graphics

Physics

See Console commands & debugging

Making your own console commands and variables

Cheat Scripts

You can make a special console commands that can run multiple commands. See docs. See also Cheat Console Cheat Scripts

Exec and FSelfRegisteringExec

Statics

  • For static variables (int32, float, bool, FString) see FAutoConsoleVariableRef
  • For static commands see FAutoConsoleObject and the childs such as FAutoConsoleCommandWithWorld or FAutoConsoleCommand (I have some helpers for that in My plugins)

Code snippets

static float DrawingShowFlagsMaxDrawDistance = 3500;  
static FAutoConsoleVariableRef CVarDrawingShowFlagsMaxDrawDistance(  
    TEXT("BrutalPuzzle.Editor.DrawingShowFlagsMaxDrawDistance"),
    DrawingShowFlagsMaxDrawDistance,  
    TEXT("Limits the drawing of custom show flags to this distance"),  
    ECVF_Default  
);
void ClearTrackedPrefabReferenceComponents()  {}
FU_Console::FFUAutoConsoleCommand CClearTrackedPrefabReferenceComponents(
"Editor", "ClearTrackedPrefabReferenceComponents", "Clear all tracked components",
FConsoleCommandDelegate::CreateStatic(ClearTrackedPrefabReferenceComponents));

Run commands from code

Blueprint

Use the Execute Console Command node, the player parameter is not required in all cases.

C++

We can use the same logic than the BP node (UKismetSystemLibrary::ExecuteConsoleCommand). Internally it uses ConsoleCommand on the Player Controller if valid and Exec on the GEngine if not. It seems safer to use the kismet function because it has some extra safety measures.