GameFeatureOptionalContentInstaller.Enable
GameFeatureOptionalContentInstaller.Enable
#Overview
name: GameFeatureOptionalContentInstaller.Enable
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable optional content installer
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of GameFeatureOptionalContentInstaller.Enable is to control the activation of the optional content installer for Game Features in Unreal Engine 5. This setting variable is part of the Game Features plugin, which is a runtime module for managing modular gameplay features.
This setting variable is primarily used by the Game Features subsystem, specifically within the GameFeatures plugin. It’s referenced in the GameFeatureOptionalContentInstaller.cpp file, which is responsible for handling the installation of optional content for Game Features.
The value of this variable is set as a console variable (CVar) with a default value of true. It can be changed at runtime through the console or programmatically.
The associated variable CVarEnableOptionalContentInstaller directly interacts with GameFeatureOptionalContentInstaller.Enable. It’s defined as a TAutoConsoleVariable
Developers must be aware that this variable controls whether the optional content installer is active or not. When disabled, the system won’t attempt to install optional content for Game Features, which could affect the availability of certain game content or features.
Best practices when using this variable include:
- Consider the implications of disabling the optional content installer, as it may impact the user experience.
- Use it in conjunction with other Game Features settings for a comprehensive content management strategy.
- Monitor its state during development and testing to ensure desired behavior.
Regarding the associated variable CVarEnableOptionalContentInstaller:
Its purpose is to provide a runtime-modifiable way to enable or disable the optional content installer. It’s used within the Game Features plugin to determine whether the installer should be active.
The value of CVarEnableOptionalContentInstaller is set when it’s declared and can be modified through the console or programmatically. It’s checked in the UGameFeatureOptionalContentInstaller::Init and UGameFeatureOptionalContentInstaller::Enable functions to determine the current state of the installer.
Developers should be aware that changes to this console variable will trigger the OnCVarsChanged callback, potentially affecting the behavior of the optional content installer at runtime.
Best practices for using CVarEnableOptionalContentInstaller include:
- Use it for debugging or testing scenarios where you need to quickly toggle the optional content installer.
- Be cautious when modifying it in a shipping build, as it could affect the game’s content availability.
- Consider adding logging or notifications when its value changes to track its usage during development.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeatures/Private/GameFeatureOptionalContentInstaller.cpp:16
Scope (from outer to inner):
file
namespace GameFeatureOptionalContentInstaller
Source code excerpt:
static const FStringView ErrorNamespace = TEXTVIEW("GameFeaturePlugin.OptionalDownload.");
static TAutoConsoleVariable<bool> CVarEnableOptionalContentInstaller(TEXT("GameFeatureOptionalContentInstaller.Enable"),
true,
TEXT("Enable optional content installer"));
}
TMulticastDelegate<void(const FString& PluginName, const UE::GameFeatures::FResult&)> UGameFeatureOptionalContentInstaller::OnOptionalContentInstalled;
#Associated Variable and Callsites
This variable is associated with another variable named CVarEnableOptionalContentInstaller
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeatures/Private/GameFeatureOptionalContentInstaller.cpp:16
Scope (from outer to inner):
file
namespace GameFeatureOptionalContentInstaller
Source code excerpt:
static const FStringView ErrorNamespace = TEXTVIEW("GameFeaturePlugin.OptionalDownload.");
static TAutoConsoleVariable<bool> CVarEnableOptionalContentInstaller(TEXT("GameFeatureOptionalContentInstaller.Enable"),
true,
TEXT("Enable optional content installer"));
}
TMulticastDelegate<void(const FString& PluginName, const UE::GameFeatures::FResult&)> UGameFeatureOptionalContentInstaller::OnOptionalContentInstalled;
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeatures/Private/GameFeatureOptionalContentInstaller.cpp:37
Scope (from outer to inner):
file
function void UGameFeatureOptionalContentInstaller::Init
Source code excerpt:
CVarSinkHandle = IConsoleManager::Get().RegisterConsoleVariableSink_Handle(
FConsoleCommandDelegate::CreateUObject(this, &UGameFeatureOptionalContentInstaller::OnCVarsChanged));
bEnabledCVar = GameFeatureOptionalContentInstaller::CVarEnableOptionalContentInstaller.GetValueOnGameThread();
}
void UGameFeatureOptionalContentInstaller::Enable(bool bInEnable)
{
bool bOldEnabled = IsEnabled();
bEnabled = bInEnable;
bEnabledCVar = GameFeatureOptionalContentInstaller::CVarEnableOptionalContentInstaller.GetValueOnGameThread();
bool bNewEnabled = IsEnabled();
if (bOldEnabled != bNewEnabled)
{
if (bNewEnabled)
{