console.position.enable

console.position.enable

#Overview

name: console.position.enable

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of console.position.enable is to control the custom positioning of the game console in Unreal Engine 5. This setting variable is part of the user interface system, specifically for the in-game console functionality.

This setting variable is primarily used in the Engine module, specifically in the console rendering system. Based on the callsites, it is referenced in the UConsole class, which is responsible for handling the in-game console functionality.

The value of this variable is set using a TAutoConsoleVariable named CVarCustomConsolePosEnabled. It is initialized with a default value of 0, which means custom console positioning is disabled by default.

This variable interacts with two other variables: CVarConsoleXPos and CVarConsoleYPos. These variables determine the X and Y positions of the console when custom positioning is enabled.

Developers must be aware that enabling this variable will override the default console positioning. They should also set appropriate values for console.position.x and console.position.y to achieve the desired console placement.

Best practices when using this variable include:

  1. Only enable it when custom console positioning is necessary.
  2. Ensure that the X and Y position values are within the screen boundaries.
  3. Test the console positioning on different screen resolutions to ensure it remains visible and usable.

Regarding the associated variable CVarCustomConsolePosEnabled:

The purpose of CVarCustomConsolePosEnabled is to serve as the C++ representation of the console.position.enable console variable. It is used internally by the engine to check whether custom console positioning is enabled.

This variable is used in the UConsole::PostRender_Console_Typing and UConsole::PostRender_Console_Open functions to determine if custom positioning should be applied when rendering the console.

The value of this variable is set automatically by the engine based on the console.position.enable console command.

CVarCustomConsolePosEnabled interacts directly with CVarConsoleXPos and CVarConsoleYPos to determine the console’s position when custom positioning is enabled.

Developers should be aware that this variable is internal to the engine and should not be modified directly. Instead, they should use the console.position.enable console command to control custom console positioning.

Best practices for using this variable include:

  1. Accessing its value using the GetValueOnAnyThread() method, as shown in the provided code snippets.
  2. Avoiding direct modification of this variable and instead using the corresponding console command.
  3. Using it in conjunction with the X and Y position variables when implementing custom console rendering logic.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterface/Console.cpp:41

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarCustomConsolePosEnabled(
	TEXT("console.position.enable"),
	0,
	TEXT("Enable custom console positioning \n"),
	ECVF_Default);

static TAutoConsoleVariable<int32> CVarConsoleXPos(
	TEXT("console.position.x"),

#Associated Variable and Callsites

This variable is associated with another variable named CVarCustomConsolePosEnabled. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterface/Console.cpp:40

Scope: file

Source code excerpt:

UConsole::FOnConsoleActivationStateChanged UConsole::OnConsoleActivationStateChanged;

static TAutoConsoleVariable<int32> CVarCustomConsolePosEnabled(
	TEXT("console.position.enable"),
	0,
	TEXT("Enable custom console positioning \n"),
	ECVF_Default);

static TAutoConsoleVariable<int32> CVarConsoleXPos(

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterface/Console.cpp:1220

Scope (from outer to inner):

file
function     void UConsole::PostRender_Console_Typing

Source code excerpt:

	float LeftPos = 0;

	if (CVarCustomConsolePosEnabled.GetValueOnAnyThread())
	{
		LeftPos = (float)CVarConsoleXPos.GetValueOnAnyThread();
		float BottomOffset = (float)CVarConsoleYPos.GetValueOnAnyThread();
		ClipY = ClipY - BottomOffset;
	}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterface/Console.cpp:1318

Scope (from outer to inner):

file
function     void UConsole::PostRender_Console_Open

Source code excerpt:

	float LeftPos = 0;

	if (CVarCustomConsolePosEnabled.GetValueOnAnyThread())
	{
		LeftPos = (float)CVarConsoleXPos.GetValueOnAnyThread();
		float BottomOffset = (float)CVarConsoleYPos.GetValueOnAnyThread();
		Height = Canvas->ClipY - BottomOffset;
	}