๐Ÿ›ก๏ธ Extension Resource Guard

Short Description

Extension Resource Guards are Data Assets that declare plugin dependencies for specific extension content packs. They are validated at editor startup to ensure required plugins are enabled, and if not, they trigger user prompts and enforcement mechanisms to resolve the issue.

Long Description

The Extension Resource Guard system provides a way to declare and enforce plugin dependencies for specific content packs in your project. By creating a UGorgeousExtensionResourceGuard data asset, you can specify which plugins are required for a particular system or content pack to function properly. During editor startup, the system validates all registered guards and checks if their required plugins are enabled. If any required plugins are missing, the user is prompted to enable them. If the user chooses not to enable the plugins immediately, an enforcement subsystem activates, reminding the user to resolve the issue and eventually shutting down the editor gracefully if it remains unresolved.

This system ensures that users are aware of necessary plugin dependencies and encourages them to maintain a properly configured editor environment for the best experience with your extension content packs.

Guard Types

There are two types of guards:

  1. Content Pack Guards: These protect specific content packs on disk and check for the presence of the content directory. If the directory is missing, the guard is considered inactive and no validation or enforcement occurs.
  2. Empty Guards: These do not protect any content on disk but still declare plugin dependencies. They are always considered active and are useful for systems that rely solely on C++ classes without associated content.
Nothing to Call

There are no functions to call on the guard itself - it is purely a data asset that is validated at startup. The enforcement subsystem handles all user interaction and resolution steps based on the guard's data.

๐Ÿ›ก๏ธ Guards

The UGorgeousExtensionResourceGuard class defines the structure of the data asset used to declare plugin dependencies for extension content packs. The guard is validated at editor startup, and its properties are used by the enforcement subsystem to determine if any required plugins are missing and to guide the user through resolving the issue.

Variable Name Type Description
SystemIdentifier FName A unique identifier for the system this guard protects. Must be unique across the entire project - no two guard instances may share the same SystemIdentifier.
SystemDisplayName FText A human-readable display name for the system, used in log messages and validation output to inform the user about which system requires attention.
RequiredPlugins TArray<FName> An array of plugin names that must be enabled for this system's content to function. The validator will check each entry against IPluginManager and report any missing plugins with a hyperlink to enable them.
OwningPluginName FName The name of the plugin whose Content directory owns this system's content pack, e.g. "GorgeousCore". This is used to resolve the content path and manage plugin dependencies.
bIsContentPackGuard bool When true, this guard protects a content pack on disk and ContentSubPath is used to verify its presence. When false, this is a content-less ("empty") guard - useful for declaring plugin dependencies that only C++ classes rely on. ContentSubPath is ignored and the guard is always considered active when this is false.
ContentSubPath FString Relative sub-path within the owning plugin's Content directory, e.g. "Systems/Playlist". Resolved at runtime to /Content/. If the directory does not exist on disk the entire guard is considered inactive - validation, enforcement, and all warnings are skipped. This allows the content pack to be optional / removable. Only used when bIsContentPackGuard is true.

๐Ÿงฉ Enforcement Subsystem

The UGorgeousExtensionResourceGuardEnforcer class is an editor subsystem that activates when a user rejects the prompt to enable required plugins for an extension content pack. It periodically reminds the user to enable the plugins and eventually shuts down the editor gracefully if the issue remains unresolved, ensuring that users are aware of necessary plugin dependencies and encouraging them to maintain a properly configured editor environment.