Slate.GameLayer.AllCanvasesVisible
Slate.GameLayer.AllCanvasesVisible
#Overview
name: Slate.GameLayer.AllCanvasesVisible
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Show/Hide the viewport slot, player canvas, and debug canvas.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Slate.GameLayer.AllCanvasesVisible is to control the visibility of multiple UI elements in the game’s user interface, specifically the viewport slot, player canvas, and debug canvas. This setting is part of Unreal Engine’s Slate UI framework and is used in the game layer management system.
This setting variable is primarily used in the Engine module, specifically within the Slate subsystem for managing game layers. Based on the callsites, it’s implemented in the SGameLayerManager class, which is responsible for organizing and rendering different UI layers in the game.
The value of this variable is set as a console variable (CVar) using TAutoConsoleVariable. It’s initialized with a default value of true, meaning all canvases are visible by default. Developers can change this value at runtime using console commands.
The associated variable CVarShowAllCanvases directly interacts with Slate.GameLayer.AllCanvasesVisible. They share the same value and purpose. CVarShowAllCanvases is the C++ representation of the console variable, allowing for programmatic access and manipulation within the engine’s code.
Developers should be aware that this variable is marked with ECVF_Cheat flag, indicating it’s intended for debugging or cheating purposes and should not be exposed to end-users in production builds. Changing this variable will affect the visibility of all main UI canvases simultaneously, which could have a significant impact on the game’s visual presentation and functionality.
Best practices when using this variable include:
- Use it primarily for debugging and testing purposes.
- Be cautious when changing its value in production environments, as it affects multiple UI elements at once.
- Consider using more specific visibility controls (like CVarShowPlayerCanvas or CVarShowDebugCanvas) for fine-tuned UI management.
- When modifying this variable, ensure that critical UI elements remain accessible to prevent breaking game functionality.
Regarding the associated variable CVarShowAllCanvases:
The purpose of CVarShowAllCanvases is to provide a programmatic interface to the Slate.GameLayer.AllCanvasesVisible console variable within the C++ code of Unreal Engine.
It’s used in the Engine module, specifically in the SGameLayerManager class, which is part of the Slate UI framework. This variable allows the engine to react to changes in the visibility settings of UI canvases.
The value of CVarShowAllCanvases is set when the console variable Slate.GameLayer.AllCanvasesVisible is modified, either through console commands or programmatically.
CVarShowAllCanvases interacts with other similar variables like CVarShowPlayerCanvas, CVarShowDebugCanvas, and CVarShowViewportSlot. These variables collectively control the visibility of different UI elements.
Developers should be aware that changes to CVarShowAllCanvases will trigger a callback function that updates the visibility of all UI canvases. This callback is set up in the SGameLayerManager::Construct function.
Best practices for using CVarShowAllCanvases include:
- Use it to programmatically control the visibility of all UI canvases when needed.
- Be mindful of its impact on game performance and user experience when modifying it.
- Consider using it in conjunction with other specific canvas visibility variables for more granular control over the UI.
- Ensure that any code relying on UI visibility is prepared to handle changes triggered by this variable.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Slate/SGameLayerManager.cpp:77
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<bool> CVarShowAllCanvases(
TEXT("Slate.GameLayer.AllCanvasesVisible"),
true,
TEXT("Show/Hide the viewport slot, player canvas, and debug canvas."),
ECVF_Cheat
);
#endif
#Associated Variable and Callsites
This variable is associated with another variable named CVarShowAllCanvases
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Slate/SGameLayerManager.cpp:76
Scope: file
Source code excerpt:
ECVF_Cheat
);
static TAutoConsoleVariable<bool> CVarShowAllCanvases(
TEXT("Slate.GameLayer.AllCanvasesVisible"),
true,
TEXT("Show/Hide the viewport slot, player canvas, and debug canvas."),
ECVF_Cheat
);
#endif
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Slate/SGameLayerManager.cpp:232
Scope (from outer to inner):
file
function void SGameLayerManager::Construct
Source code excerpt:
};
};
CVarShowAllCanvases->AsVariable()->SetOnChangedCallback(FConsoleVariableDelegate::CreateLambda(ShowHUD, CanvasVisibility::CanvasType::AllCanvases));
CVarShowPlayerCanvas->AsVariable()->SetOnChangedCallback(FConsoleVariableDelegate::CreateLambda(ShowHUD, CanvasVisibility::CanvasType::PlayerCanvas));
CVarShowDebugCanvas->AsVariable()->SetOnChangedCallback(FConsoleVariableDelegate::CreateLambda(ShowHUD, CanvasVisibility::CanvasType::DebugCanvas));
CVarShowViewportSlot->AsVariable()->SetOnChangedCallback(FConsoleVariableDelegate::CreateLambda(ShowHUD, CanvasVisibility::CanvasType::Viewport));
CanvasVisibility::CanvasVisibilityCVarOnChangedBound = true;
}