UConsole

A basic command line console that accepts most commands.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Engine/Console.h

Include

#include "Engine/Console.h"

Syntax

class UConsole :
    public UObject,
    public FOutputDevice

Remarks

A basic command line console that accepts most commands.

Variables

Name Description

Public variable

TArray< FAutoCo...

 

AutoComplete

Current list of matching commands for auto-complete,

Public variable

int32

 

AutoCompleteCursor

-1: auto complete cursor is not visible, >=0

Public variable

int32

 

AutoCompleteIndex

Currently selected auto complete index

Public variable

TArray< FAutoCo...

 

AutoCompleteList

Full list of auto-complete commands and info

Public variable

FAutoCompleteNo...

 

AutoCompleteTree

Public variable

uint32: 1

 

bAutoCompleteLocked

Is the current auto-complete selection locked

Public variable

uint32: 1

 

bCaptureKeyInput

Indicates that InputChar events should be captured to prevent them from being passed on to other interactions.

Public variable

uint32: 1

 

bCtrl

True while a control key is pressed.

Public variable

uint32: 1

 

bIsRuntimeAutoCompleteUpToDate

Do we need to rebuild auto complete?

Public variable

uint32: 1

 

bShift

True while a shift key is pressed.

Public variable

FName

 

ConsoleState

NAME_Typing, NAME_Open or NAME_None.

Public variable

ULocalPlayer &#...

 

ConsoleTargetPlayer

The player which the next console command should be executed in the context of.

Public variable

UTexture2D *...

 

DefaultTexture_Black

Public variable

UTexture2D *...

 

DefaultTexture_White

Public variable

TArray< FString...

 

HistoryBuffer

Holds the history buffer, order is old to new

Public variable

FString

 

LastAutoCompletedCommand

The most recent input that was autocompleted during this open console session.

Public variable

FString

 

PrecompletedInputLine

The command the user would get if they autocompleted their current input.

Public variable

int32

 

SBHead

Where in the scrollback buffer are we

Public variable

int32

 

SBPos

Public variable

TArray< FString...

 

Scrollback

Holds the scrollback buffer

Public variable

FString

 

TypedStr

The command the user is currently typing.

Public variable

int32

 

TypedStrPos

Constructors

Name Description

Public function

UConsole

(
    const FObjectInitializer& ObjectIn...
)

Destructors

Name Description

Public function

~UConsole()

Functions

Name Description

Public function Virtual

void

 

AppendInputText

(
    const FString& Text
)

Appends the specified text to the string of typed text

Public function Virtual

void

 

AugmentRuntimeAutoCompleteList

(
    TArray< FAutoCompleteCommand >& Li...
)

Virtual function to allow subclasses of UConsole to add additional commands

Public function Virtual

void

 

BeginState_Open

(
    FName PreviousStateName
)

Perform actions on transition to the Open state

Public function Virtual

void

 

BeginState_Typing

(
    FName PreviousStateName
)

Perform actions on transition to Typing state

Public function Virtual

void

 

BuildRuntimeAutoCompleteList

(
    bool bForce
)

Build the list of auto complete console commands

Public function Virtual

void

 

ClearOutput()

Clears the console output buffer.

Public function Virtual Const

bool

 

ConsoleActive()

Public function Virtual

void

 

ConsoleCommand

(
    const FString& Command
)

Executes a console command.

Public function Virtual

void

 

EndState_Open

(
    FName NextStateName
)

Perform actions on transition from Open state

Public function Virtual

void

 

EndState_Typing

(
    FName NextStateName
)

Perform actions on transition from Typing state

Public function Virtual

void

 

FakeGotoState

(
    FName NextStateName
)

Controls state transitions for the console

Public function Virtual

void

 

FlushPlayerInput()

Clears out all pressed keys from the player's input object.

Public function Virtual

bool

 

InputAxis

(
    int32 ControllerId,
    FKey Key,
    float Delta,
    float DeltaTime,
    int32 NumSamples,
    bool bGamepad
)

Public function Virtual

bool

 

InputChar

(
    int32 ControllerId,
    const FString& Unicode
)

Public function Virtual

bool

 

InputChar_Open

(
    int32 ControllerId,
    const FString& Unicode
)

This state is used when the console is open.

Public function Virtual

bool

 

InputChar_Typing

(
    int32 ControllerId,
    const FString& Unicode
)

Process a character input event (typing) routed through unrealscript from another object.

Public function Virtual

bool

 

InputKey

(
    int32 ControllerId,
    FKey Key,
    EInputEvent Event,
    float AmountDepressed,
    bool bGamepad
)

Public function Virtual

bool

 

InputKey_Open

(
    int32 ControllerId,
    FKey Key,
    EInputEvent Event,
    float AmountDepressed,
    bool bGamepad
)

Process an input key event routed through unrealscript from another object.

Public function Virtual

bool

 

InputTouch

(
    int32 ControllerId,
    uint32 Handle,
    ETouchType::Type Type,
    const FVector2D& TouchLocation,
    float Force,
    FDateTime DeviceTimestamp,
    uint32 TouchpadIndex
)

Public function Virtual

void

 

OutputText

(
    const FString& Text
)

Prints a (potentially multi-line) FString of text to the console.

Public function Virtual

void

 

PostRender_Console

(
    UCanvas* Canvas
)

Render to the canvas based on the console state

Public function Virtual

void

 

PostRender_Console_Open

(
    UCanvas* Canvas
)

Perform rendering of the console on the canvas

Public function Virtual

void

 

PostRender_Console_Typing

(
    UCanvas* Canvas
)

Perform rendering of the console on the canvas

Public function Virtual

bool

 

ProcessControlKey

(
    FKey Key,
    EInputEvent Event
)

Looks for Control key presses and the copy/paste combination that apply to both the console bar and the full open console

Public function Virtual

bool

 

ProcessShiftKey

(
    FKey Key,
    EInputEvent Event
)

Looks for Shift key presses

Public function Virtual

void

 

SetCursorPos

(
    int32 Position
)

Set cursor position for typing text

Public function Virtual

void

 

SetInputText

(
    const FString& Text
)

Set the input to text

Public function Virtual

void

 

StartTyping

(
    const FString& Text
)

Opens the typing bar with text already entered.

Public function Virtual

void

 

UpdateCompleteIndices()

Update the auto complete indices from the typed string

Overridden from UObject

Name Description

Public function Virtual

void

 

PostInitProperties()

Called after the C++ constructor and after the properties have been initialized, including those loaded from config.

Typedefs

Name

Description

FOnConsoleActivationStateChanged

Deletate for when the console is activated or deactivated

FRegisterConsoleAutoCompleteEntries

Delegate for registering hot-reloaded classes that have been added

Constants

Name

Description

MAX_HISTORY_ENTRIES

Max number of command history entries

OnConsoleActivationStateChanged

RegisterConsoleAutoCompleteEntries

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback