console.position.y

console.position.y

#Overview

name: console.position.y

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.y is to control the vertical positioning of the game console interface within the game window. It specifically sets the Y-axis offset of the console from the bottom border of the screen.

This setting variable is primarily used in the Engine module, specifically within the user interface subsystem for the in-game console. Based on the callsites, it’s clear that this variable is utilized in the Console.cpp file, which is responsible for rendering and positioning the console interface.

The value of this variable is set through the console variable system in Unreal Engine. It’s declared as a TAutoConsoleVariable with a default value of 0, meaning by default, the console will be positioned at the bottom of the screen with no offset.

The associated variable CVarConsoleYPos interacts directly with console.position.y. They share the same value, and CVarConsoleYPos is used to retrieve the current value of the console.position.y setting in the code.

Developers should be aware that changing this variable will affect the vertical positioning of the console interface. A higher value will move the console upwards from the bottom of the screen. This could be useful for adjusting the console position to avoid overlapping with other UI elements or to accommodate different screen resolutions.

Best practices when using this variable include:

  1. Consider the impact on different screen resolutions and aspect ratios when adjusting this value.
  2. Use in conjunction with console.position.x for full control over console positioning.
  3. Test thoroughly to ensure the console remains visible and doesn’t interfere with other UI elements.

Regarding the associated variable CVarConsoleYPos:

The purpose of CVarConsoleYPos is to provide a programmatic interface to access the value of console.position.y within the C++ code.

It’s used in the Engine module, specifically in the Console rendering functions.

The value of CVarConsoleYPos is set automatically by the console variable system to match console.position.y.

CVarConsoleYPos interacts directly with console.position.y, effectively serving as its in-code representation.

Developers should be aware that CVarConsoleYPos.GetValueOnAnyThread() is used to retrieve the current console Y position in the rendering code. Any changes to console.position.y will be reflected in the value returned by this function.

Best practices for using CVarConsoleYPos include:

  1. Use GetValueOnAnyThread() when you need the current console Y position in code.
  2. Remember that this value can change at runtime if the console.position.y is modified.
  3. Consider caching the value if used frequently in performance-critical sections to avoid repeated calls to GetValueOnAnyThread().

#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:53

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarConsoleYPos(
	TEXT("console.position.y"),
	0,
	TEXT("Console Y offset from bottom border \n"),
	ECVF_Default);

static TAutoConsoleVariable<bool> CVarConsoleLegacySearch(
	TEXT("console.searchmode.legacy"),

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_Default);

static TAutoConsoleVariable<int32> CVarConsoleYPos(
	TEXT("console.position.y"),
	0,
	TEXT("Console Y offset from bottom border \n"),
	ECVF_Default);

static TAutoConsoleVariable<bool> CVarConsoleLegacySearch(

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

Scope (from outer to inner):

file
function     void UConsole::PostRender_Console_Typing

Source code excerpt:

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

	PostRender_InputLine(Canvas, FIntPoint(LeftPos, ClipY));
}

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

Scope (from outer to inner):

file
function     void UConsole::PostRender_Console_Open

Source code excerpt:

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

	UFont* Font = GEngine->GetSmallFont();

	const float DPIScale = Canvas->GetDPIScale();