ReleaseGameFeaturePlugin
ReleaseGameFeaturePlugin
#Overview
name: ReleaseGameFeaturePlugin
This variable is created as a Console Variable (cvar).
- type:
Cmd
- help:
Releases a game feature plugin\'s InstallBundle data by PluginName or URL
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ReleaseGameFeaturePlugin is to release the game data stored for a specific Game Feature Plugin without uninstalling it from disk. This function is part of the Game Features subsystem in Unreal Engine 5, which allows for dynamic loading and unloading of game features during runtime.
The Game Features subsystem relies on this variable, as it is a method within the UGameFeaturesSubsystem class. This subsystem is responsible for managing the lifecycle of Game Feature Plugins, including their loading, activation, deactivation, and release.
The value of this variable is not set directly, as it is a method name rather than a settable variable. However, it is called in two ways:
- As a console command registered in the Initialize function of UGameFeaturesSubsystem.
- As a public method of the UGameFeaturesSubsystem class, which can be called from other parts of the engine or game code.
This method interacts with other parts of the Game Features subsystem, particularly the UGameFeaturePluginStateMachine class, which manages the state of individual Game Feature Plugins.
Developers must be aware that:
- This method only releases the game data in memory and does not uninstall the plugin from disk.
- It should be used when you want to free up memory but might need to reload the plugin later.
- The plugin can be identified either by its name or URL.
Best practices when using this variable include:
- Use it as part of a proper plugin management strategy, ensuring plugins are released when no longer needed to conserve memory.
- Always check if the plugin exists before attempting to release it to avoid potential errors.
- Consider using the overloaded version with a completion delegate if you need to perform actions after the release is complete.
- Be cautious when using the console command version in production builds, as it’s marked with ECVF_Cheat flag.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeatures/Private/GameFeaturesSubsystem.cpp:426
Scope (from outer to inner):
file
function void UGameFeaturesSubsystem::Initialize
Source code excerpt:
IConsoleManager::Get().RegisterConsoleCommand(
TEXT("ReleaseGameFeaturePlugin"),
TEXT("Releases a game feature plugin's InstallBundle data by PluginName or URL"),
FConsoleCommandWithWorldArgsAndOutputDeviceDelegate::CreateLambda([](const TArray<FString>& Args, UWorld*, FOutputDevice& Ar)
{
if (TOptional<FString> PluginURL = UE::GameFeatures::GetPluginUrlForConsoleCommand(Args, Ar))
{
UGameFeaturesSubsystem::Get().ReleaseGameFeaturePlugin(PluginURL.GetValue());
}
}),
ECVF_Cheat);
IConsoleManager::Get().RegisterConsoleCommand(
TEXT("CancelGameFeaturePlugin"),
TEXT("Cancel any state changes for a game feature plugin by PluginName or URL"),
FConsoleCommandWithWorldArgsAndOutputDeviceDelegate::CreateLambda([](const TArray<FString>& Args, UWorld*, FOutputDevice& Ar)
{
if (TOptional<FString> PluginURL = UE::GameFeatures::GetPluginUrlForConsoleCommand(Args, Ar))
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeatures/Private/GameFeaturesSubsystem.cpp:1557
Scope (from outer to inner):
file
function void UGameFeaturesSubsystem::ReleaseGameFeaturePlugin
Source code excerpt:
}
void UGameFeaturesSubsystem::ReleaseGameFeaturePlugin(const FString& PluginURL)
{
ReleaseGameFeaturePlugin(PluginURL, FGameFeaturePluginReleaseComplete());
}
void UGameFeaturesSubsystem::ReleaseGameFeaturePlugin(const FString& PluginURL, const FGameFeaturePluginReleaseComplete& CompleteDelegate)
{
if (UGameFeaturePluginStateMachine* StateMachine = FindGameFeaturePluginStateMachine(PluginURL))
{
ChangeGameFeatureDestination(StateMachine, FGameFeaturePluginStateRange(EGameFeaturePluginState::Terminal, EGameFeaturePluginState::StatusKnown), CompleteDelegate);
}
else
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeatures/Public/GameFeaturesSubsystem.h:549
Scope (from outer to inner):
file
class class UGameFeaturesSubsystem : public UEngineSubsystem
Source code excerpt:
/** Releases any game data stored for this GameFeaturePlugin. Does not uninstall data and it will remain on disk. */
void ReleaseGameFeaturePlugin(const FString& PluginURL);
void ReleaseGameFeaturePlugin(const FString& PluginURL, const FGameFeaturePluginReleaseComplete& CompleteDelegate);
/** Uninstalls any game data stored for this GameFeaturePlugin and terminates the GameFeaturePlugin.
If the given PluginURL is not found this will create a GameFeaturePlugin first and attempt to run it through the uninstall flow.
This allows for the uninstalling of data that was installed on previous runs of the application where we haven't yet requested the
GameFeaturePlugin that we would like to uninstall data for on this run. */
void UninstallGameFeaturePlugin(const FString& PluginURL, const FGameFeaturePluginUninstallComplete& CompleteDelegate = FGameFeaturePluginUninstallComplete());