ue-game-features

Use this skill when working with Game Feature plugins, modular gameplay, GameFeatureAction, GameFeatureData, GameFrameworkComponentManager, init state system, experience system, modular components, UPawnComponent, UControllerComponent, UGameStateComponent, UPlayerStateComponent, or Lyra-style modula

By quodsoler · 784 installs

npx skills add quodsoler/unreal-engine-skills --skill ue-game-features

Source repository · Upstream listing

UE Game Features and Modular Gameplay You are an expert in Unreal Engine's Game Features plugin system and modular gameplay architecture. Context Check Read .agents/ue project context.md before proceeding. Determine: Whether the GameFeatures and ModularGameplay plugins are enabled Which actors register as component receivers ( AddReceiver ) Whether the project uses an init state system or experience based loading Existing UGameFeatureAction subclasses or modular component base classes Information Gathering Ask the developer: 1. Are you creating a new Game Feature plugin or extending an existing one? 2. What components or abilities should the feature inject into gameplay actors? 3. Does the feature need async loading or runtime activation/deactivation? 4. Is there an experience/game mode composition system (Lyra style)? 5. Do components need ordered initialization across features? Game Feature Plugin Structure A Game Feature plugin is a standard UE plugin with Type set to "GameFeature" in its .uplugin descriptor. This tells the engine to manage its lifecycle through the Game Features subsystem rather than loading it as a regular plugin. .uplugin Descriptor BuiltInInitialFeatureState controls how far the plugin advances on startup. Use "Active" for always on features, "Registered" for features activated by gameplay code, or "Installed" for downloadable content loaded on demand. UGameFeatureData Each Game Feature plugin contains a UGameFeatureData primary data asset (extends UPrimaryDataAsset ) that defines what the feature does: Actions is the core — an instanced array of UGameFeatureAction subclasses that execute when the feature activates. Directory Convention Plugin State Machine Game Feature plugins transition through a well defined state machine. Actions fire at specific transitions and runtime activation must target valid destination states. EGameFeaturePluginState Lifecycle Each major state has transition states between them (e.g., Registering , Loading , Activating ). You target a destination state and the subsystem walks the chain. Destination States State Description Terminal Plugin removed from tracking entirely StatusKnown Availability confirmed (exists on disk or bundle) Installed Files on local storage, not yet registered Registered Assets registered with Asset Manager, actions notified Loaded Assets loaded into memory Active Actions fully activated, components injected URL protocols: file: for built in disk plugins, installbundle: for downloadable features. Convert descriptor path to URL with UGameFeaturesSubsystem::GetPluginURL FileProtocol(Path) . UGameFeatureAction UGameFeatureAction ( UCLASS(MinimalAPI, DefaultToInstanced, EditInlineNew, Abstract) ) is the base class for all actions. DefaultToInstanced + EditInlineNew allow instances to be created inline within UGameFeatureData 's Actions array. Lifecycle Methods OnGameFeatureActivating(Context) is the primary override. The base calls the legacy no arg version for backward compatibility. Async Deactivation When deactivation requires async work, pause it via the context: See references/game feature patterns.md for complete custom action subclass templates. Built in Actions UGameFeatureAction AddComponents UCLASS(MinimalAPI, meta=(DisplayName="Add Components"), final) . The most commonly used action — injects components into actors via UGameFrameworkComponentManager . Configuration uses FGameFeatureComponentEntry : Internally stores TSharedPtr<FComponentRequestHandle — RAII removes components when the handle drops (feature deactivates). Set both bClientComponent and bServerComponent for components needed everywhere, server only for gameplay logic, client only for cosmetic. Other Built in Actions Action Purpose UGameFeatureAction AddCheats Register cheat manager extensions UGameFeatureAction DataRegistry Register data registry sources UGameFeaturesSubsystem UGameFeaturesSubsystem ( UEngineSubsystem ) manages all Game Feature plugin lifecycles: Runtime Activation and Deactivation Query and Observe IGameFeatureStateChangeObserver provides: OnGameFeatureRegistering(Data, PluginName, URL) , OnGameFeatureActivating(Data, URL) , OnGameFeatureDeactivating(Data, Context, URL) . Component Injection System UGameFrameworkComponentManager ( UGameInstanceSubsystem ) is the runtime engine that injects components into actors. It is a Game Instance subsystem — not an engine subsystem: Actor Registration (Receivers) Actors must register as receivers to accept injected components: Component Requests (RAII) Flag Value Behavior None 0 Default, allows duplicates AddUnique 1 Skip if same class already exists AddIfNotChild 2 Skip if a child class already exists UseAutoGeneratedName 4 Auto generated name instead of class name Extension Handlers and Events Standard event names: NAME ReceiverAdded , NAME ReceiverRemoved , NAME ExtensionAdded , NAME ExtensionRemoved , NAME GameActorReady . Send custom events with CompMgr SendExtensionEvent(Actor, FName("MyEvent")) . Init State System The init state system solves ordered initialization across independently loaded features. Without it, Component A might read from Component B before B exists — a common problem in modular architectures. Registering Init States Define project wide init states as FGameplayTag values in a fixed order: Changing and Observing Init State IGameFrameworkInitStateInterface Implement on components for structured init state progression: ContinueInitStateChain(TArray<FGameplayTag {State1, State2, State3}) attempts to advance through a sequence of states. Use this in CheckDefaultInitialization to auto advance as far as possible. Modular Component Hierarchy The ModularGameplay plugin provides typed base components for gameplay framework actors: Base Class Parent Typed Accessor UGameFrameworkComponent UActorComponent None (generic base) UPawnComponent UGameFrameworkComponent GetPawn<T () , GetPawnChecked<T () UControllerComponent UGameFrameworkComponent GetController<T () , GetControllerChecked<T () UGameStateComponent UGameFrameworkComponent GetGameState<T () , GetGameStateChecked<T () UPlayerStateComponent UGameFrameworkComponent GetPlayerState<T () , GetPlayerStateChecked<T () Use these instead of raw UActorComponent for type safe owner access and init state integration. Experience System Pattern The experience system (pioneered by Lyra) composes game modes from Game Feature plugins at runtime. Instead of a monolithic GameMode, lightweight experience data assets list which features to activate. Core Flow A UExperienceManagerComponent on AGameStateBase orchestrates loading. Systems bind to its OnExperienceLoaded delegate rather than assuming features are available at BeginPlay . See references/experience system.md for the full pattern with code templates. Project Policies UGameFeaturesProjectPolicies controls feature loading behavior. Override IsPluginAllowed(PluginURL, OutReason) to filter plugins, GetGameFeatureLoadingMode(bLoadClientData, bLoadServerData) for network filtering, and InitGameFeatureManager() / ShutdownGameFeatureManager() for custom lifecycle. Register via DefaultGame.ini under GameFeaturesSubsystemSettings . See references/game feature patterns.md for the full policies subclass template. Common Mistakes Missing receiver registration: Leaking FComponentRequestHandle: Using BeginPlay for cross component init: Forgetting PauseDeactivationUntilComplete delegate: If you call PauseDeactivationUntilComplete but never invoke the returned delegate, plugin deactivation hangs indefinitely. Always invoke it, even on error paths. Wrong subsystem type for ComponentManager: Related Skills ue gameplay framework — GameMode, GameState, PlayerController, PlayerState lifecycle ue actor component architecture — Component creation, attachment, tick management ue gameplay abilities — GAS integration with modular components ue data assets tables — Primary data assets, Asset Manager scanning ue module build system — Plugin structure, Build.cs dependencies ue world level streaming — Level streaming, seamless travel interactions