PluginTemplates
PluginTemplates
#Overview
name: PluginTemplates
The value of this variable can be defined or overridden in .ini config files. 6
.ini config files referencing this setting variable.
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of PluginTemplates is to store and manage a collection of game feature plugin templates that can be used in the Unreal Engine plugin creation wizard. These templates allow projects to specify reusable plugin structures for creating new game feature plugins.
PluginTemplates is primarily used within the GameFeaturesEditor module, which is part of the Game Features system in Unreal Engine 5. This system allows developers to create modular gameplay features that can be dynamically loaded and unloaded at runtime.
The value of this variable is set in the CachePluginTemplates function, which populates the PluginTemplates array based on the settings defined in the UGameFeaturesEditorSettings class. The settings are typically configured through the project settings in the Unreal Editor.
PluginTemplates interacts with other components of the engine, particularly:
- The IPluginsEditorFeature interface, which is used to register and unregister the plugin templates with the engine’s plugin editor.
- The UGameFeaturesEditorSettings class, which defines the configuration for these plugin templates.
Developers should be aware of the following when using this variable:
- Changes to the PluginTemplates settings in the UGameFeaturesEditorSettings will trigger a reset of the templates through the OnSettingsChanged function.
- The templates are used to populate options in the plugin creation wizard, so ensuring the templates are well-defined and relevant to the project is important.
Best practices when using this variable include:
- Defining a diverse set of plugin templates that cover common use cases for your project.
- Regularly reviewing and updating the templates to ensure they remain relevant and useful.
- Documenting the purpose and structure of each template to help other developers understand when and how to use them.
- Ensuring that the paths and default settings specified in the templates are valid and up-to-date.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditor.ini:645, section: [/Script/GameFeaturesEditor.GameFeaturesEditorSettings]
- INI Section:
/Script/GameFeaturesEditor.GameFeaturesEditorSettings
- Raw value:
(Path=(Path="../../Plugins/Runtime/GameFeatures/Templates/GameFeaturePluginContentOnly"),Label=NSLOCTEXT("[/Script/GameFeaturesEditor]", "E17DB7E94A2C0F5968A52E89959864C0", "Game Feature (Content Only)"),Description=NSLOCTEXT("[/Script/GameFeaturesEditor]", "CB5136B64AFAFBA5EDEA078FCAC7BCC9", "Create a new Game Feature Plugin."),DefaultGameFeatureDataClass=None,DefaultGameFeatureDataName="")
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseEditor.ini:646, section: [/Script/GameFeaturesEditor.GameFeaturesEditorSettings]
- INI Section:
/Script/GameFeaturesEditor.GameFeaturesEditorSettings
- Raw value:
(Path=(Path="../../Plugins/Runtime/GameFeatures/Templates/GameFeaturePluginWithCode"),Label=NSLOCTEXT("[/Script/GameFeaturesEditor]", "90D6FD2A455176CEC42DD79A23AEC3B0", "Game Feature (with C++)"),Description=NSLOCTEXT("[/Script/GameFeaturesEditor]", "2B00A0E7415C8CEAA6DA609A141237F0", "Create a new Game Feature Plugin with a minimal amount of code."),DefaultGameFeatureDataClass=None,DefaultGameFeatureDataName="")
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultEditor.ini:78, section: [/Script/GameFeaturesEditor.GameFeaturesEditorSettings]
- INI Section:
/Script/GameFeaturesEditor.GameFeaturesEditorSettings
- Raw value:
(Path=(Path="../../Plugins/Runtime/GameFeatures/Templates/GameFeaturePluginContentOnly"),Label=NSLOCTEXT("[/Script/GameFeaturesEditor]", "E17DB7E94A2C0F5968A52E89959864C0", "Game Feature (Content Only)"),Description=NSLOCTEXT("[/Script/GameFeaturesEditor]", "CB5136B64AFAFBA5EDEA078FCAC7BCC9", "Create a new Game Feature Plugin."),DefaultGameFeatureDataClass=None,DefaultGameFeatureDataName="")
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultEditor.ini:79, section: [/Script/GameFeaturesEditor.GameFeaturesEditorSettings]
- INI Section:
/Script/GameFeaturesEditor.GameFeaturesEditorSettings
- Raw value:
(Path=(Path="../../Plugins/Runtime/GameFeatures/Templates/GameFeaturePluginWithCode"),Label=NSLOCTEXT("[/Script/GameFeaturesEditor]", "90D6FD2A455176CEC42DD79A23AEC3B0", "Game Feature (with C++)"),Description=NSLOCTEXT("[/Script/GameFeaturesEditor]", "2B00A0E7415C8CEAA6DA609A141237F0", "Create a new Game Feature Plugin with a minimal amount of code."),DefaultGameFeatureDataClass=None,DefaultGameFeatureDataName="")
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultEditor.ini:80, section: [/Script/GameFeaturesEditor.GameFeaturesEditorSettings]
- INI Section:
/Script/GameFeaturesEditor.GameFeaturesEditorSettings
- Raw value:
(Path=(Path="../../Plugins/Runtime/GameFeatures/Templates/GameFeaturePluginContentOnly"),Label=NSLOCTEXT("[/Script/GameFeaturesEditor]", "E17DB7E94A2C0F5968A52E89959864C0", "Game Feature (Content Only)"),Description=NSLOCTEXT("[/Script/GameFeaturesEditor]", "CB5136B64AFAFBA5EDEA078FCAC7BCC9", "Create a new Game Feature Plugin."),DefaultGameFeatureDataClass=None,DefaultGameFeatureDataName="",bIsEnabledByDefault=True)
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultEditor.ini:81, section: [/Script/GameFeaturesEditor.GameFeaturesEditorSettings]
- INI Section:
/Script/GameFeaturesEditor.GameFeaturesEditorSettings
- Raw value:
(Path=(Path="../../Plugins/Runtime/GameFeatures/Templates/GameFeaturePluginWithCode"),Label=NSLOCTEXT("[/Script/GameFeaturesEditor]", "90D6FD2A455176CEC42DD79A23AEC3B0", "Game Feature (with C++)"),Description=NSLOCTEXT("[/Script/GameFeaturesEditor]", "2B00A0E7415C8CEAA6DA609A141237F0", "Create a new Game Feature Plugin with a minimal amount of code."),DefaultGameFeatureDataClass=None,DefaultGameFeatureDataName="",bIsEnabledByDefault=True)
- Is Array:
True
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeaturesEditor/Private/GameFeaturesEditorModule.cpp:214
Scope (from outer to inner):
file
class class FGameFeaturesEditorModule : public FDefaultModuleImpl
function virtual void ShutdownModule
Source code excerpt:
}
UnregisterFunctionTemplates();
PluginTemplates.Empty();
}
}
void OnSettingsChanged(UObject* Settings, FPropertyChangedEvent& PropertyChangedEvent)
{
const FName PropertyName = PropertyChangedEvent.GetPropertyName();
const FName MemberPropertyName = (PropertyChangedEvent.MemberProperty != nullptr) ? PropertyChangedEvent.MemberProperty->GetFName() : NAME_None;
const FName PluginTemplatePropertyName = GET_MEMBER_NAME_CHECKED(UGameFeaturesEditorSettings, PluginTemplates);
if (PropertyName == PluginTemplatePropertyName
|| MemberPropertyName == PluginTemplatePropertyName)
{
ResetPluginTemplates();
}
}
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeaturesEditor/Private/GameFeaturesEditorModule.cpp:232
Scope (from outer to inner):
file
class class FGameFeaturesEditorModule : public FDefaultModuleImpl
function void CachePluginTemplates
Source code excerpt:
void CachePluginTemplates()
{
PluginTemplates.Reset();
if (const UGameFeaturesEditorSettings* GameFeatureEditorSettings = GetDefault<UGameFeaturesEditorSettings>())
{
for (const FPluginTemplateData& PluginTemplate : GameFeatureEditorSettings->PluginTemplates)
{
PluginTemplates.Add(MakeShareable(new FGameFeaturePluginTemplateDescription(
PluginTemplate.Label,
PluginTemplate.Description,
PluginTemplate.Path.Path,
PluginTemplate.DefaultSubfolder,
PluginTemplate.DefaultGameFeatureDataClass,
PluginTemplate.DefaultGameFeatureDataName,
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeaturesEditor/Private/GameFeaturesEditorModule.cpp:261
Scope (from outer to inner):
file
class class FGameFeaturesEditorModule : public FDefaultModuleImpl
function void RegisterPluginTemplates
Source code excerpt:
{
IPluginsEditorFeature& PluginEditor = IModularFeatures::Get().GetModularFeature<IPluginsEditorFeature>(EditorFeatures::PluginsEditor);
for (const TSharedPtr<FGameFeaturePluginTemplateDescription, ESPMode::ThreadSafe>& TemplateDescription : PluginTemplates)
{
PluginEditor.RegisterPluginTemplate(TemplateDescription.ToSharedRef());
}
PluginEditorExtensionDelegate = PluginEditor.RegisterPluginEditorExtension(FOnPluginBeingEdited::CreateRaw(this, &FGameFeaturesEditorModule::CustomizePluginEditing));
}
}
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeaturesEditor/Private/GameFeaturesEditorModule.cpp:274
Scope (from outer to inner):
file
class class FGameFeaturesEditorModule : public FDefaultModuleImpl
function void UnregisterFunctionTemplates
Source code excerpt:
{
IPluginsEditorFeature& PluginEditor = IModularFeatures::Get().GetModularFeature<IPluginsEditorFeature>(EditorFeatures::PluginsEditor);
for (const TSharedPtr<FGameFeaturePluginTemplateDescription, ESPMode::ThreadSafe>& TemplateDescription : PluginTemplates)
{
PluginEditor.UnregisterPluginTemplate(TemplateDescription.ToSharedRef());
}
PluginEditor.UnregisterPluginEditorExtension(PluginEditorExtensionDelegate);
}
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeaturesEditor/Private/GameFeaturesEditorModule.cpp:421
Scope (from outer to inner):
file
class class FGameFeaturesEditorModule : public FDefaultModuleImpl
Source code excerpt:
// Array of Plugin templates populated from GameFeatureDeveloperSettings. Allows projects to
// specify reusable plugin templates for the plugin creation wizard.
TArray<TSharedPtr<FGameFeaturePluginTemplateDescription>> PluginTemplates;
FPluginEditorExtensionHandle PluginEditorExtensionDelegate;
};
IMPLEMENT_MODULE(FGameFeaturesEditorModule, GameFeaturesEditor)
#undef LOCTEXT_NAMESPACE
#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeaturesEditor/Private/GameFeaturesEditorSettings.h:57
Scope (from outer to inner):
file
class class UGameFeaturesEditorSettings : public UDeveloperSettings
Source code excerpt:
// Array of Plugin templates. Allows projects to specify reusable plugin templates for the plugin creation wizard.
UPROPERTY(config, EditAnywhere, Category = Plugins)
TArray<FPluginTemplateData> PluginTemplates;
};