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:

  1. The IPluginsEditorFeature interface, which is used to register and unregister the plugin templates with the engine’s plugin editor.
  2. The UGameFeaturesEditorSettings class, which defines the configuration for these plugin templates.

Developers should be aware of the following when using this variable:

  1. Changes to the PluginTemplates settings in the UGameFeaturesEditorSettings will trigger a reset of the templates through the OnSettingsChanged function.
  2. 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:

  1. Defining a diverse set of plugin templates that cover common use cases for your project.
  2. Regularly reviewing and updating the templates to ensure they remain relevant and useful.
  3. Documenting the purpose and structure of each template to help other developers understand when and how to use them.
  4. 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]

Location: <Workspace>/Engine/Config/BaseEditor.ini:646, section: [/Script/GameFeaturesEditor.GameFeaturesEditorSettings]

Location: <Workspace>/Projects/Lyra/Config/DefaultEditor.ini:78, section: [/Script/GameFeaturesEditor.GameFeaturesEditorSettings]

Location: <Workspace>/Projects/Lyra/Config/DefaultEditor.ini:79, section: [/Script/GameFeaturesEditor.GameFeaturesEditorSettings]

Location: <Workspace>/Projects/Lyra/Config/DefaultEditor.ini:80, section: [/Script/GameFeaturesEditor.GameFeaturesEditorSettings]

Location: <Workspace>/Projects/Lyra/Config/DefaultEditor.ini:81, section: [/Script/GameFeaturesEditor.GameFeaturesEditorSettings]

#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;
};