Sein Faction Service
Class · USeinFactionService : UGameInstanceSubsystem
#include "Subsystems/SeinFactionService.h"
can be subclassed in Blueprint
Finds the playable factions in your project and hands them to the lobby so players can pick a side, and validates the faction a player claims in a lobby slot. This is the faction source selected out of the box; swap in your own to add player-designed, modded, or downloaded factions.
On startup it scans the AssetRegistry for every Sein Faction data asset and caches them as soft references (name and icon load only when the UI displays them). It re-scans when the AssetRegistry finishes loading (cooked builds can finish after this subsystem starts) and whenever you call Refresh From Asset Registry. Alongside the discovered assets you can register or unregister runtime factions (player-designed, modded, or network-imported); asset factions can only be removed by deleting the asset. Any change fires On Factions Changed so faction-picker widgets rebuild. It lives at GameInstance scope, so the cached list survives travel between the lobby and gameplay maps and stays warm.
Lookups: Get Available Factions returns everything known (assets plus runtime-registered); Get Available Factions Filtered narrows that to a preset’s allowlist (an empty allowlist means no restriction, so the full list is returned); Is Faction Valid is a linear scan the lobby uses to reject slot claims with unknown faction IDs; Resolve Faction maps a faction ID back to its underlying Sein Faction (or a null soft pointer if there is no match) so the UI can show its name and icon.
Functions
Section titled “Functions”Get Available Factions
Section titled “Get Available Factions”All known factions (AssetRegistry-discovered + runtime-registered). Default impl returns the cached list; override to mix in additional sources (modded folder, player-designed factions saved to disk, etc.).
TArray<TSoftObjectPtr<USeinFaction>> GetAvailableFactions() const;Is Faction Valid
Section titled “Is Faction Valid”True when a faction with this ID is known, as an asset or a runtime registration. ID 0 is reserved and never valid. The lobby uses it to reject slot claims for unknown factions.
bool IsFactionValid(FSeinFactionID ID) const;Resolve Faction
Section titled “Resolve Faction”Soft pointer back to the USeinFaction whose FactionID matches. Returns null soft pointer if not found. The lobby UI uses this to look up display name + icon for a given claimed faction.
TSoftObjectPtr<USeinFaction> ResolveFaction(FSeinFactionID ID) const;Get Available Factions Filtered
Section titled “Get Available Factions Filtered”The known factions that appear in Allowlist. An empty allowlist means no restriction and returns every known faction.
TArray<TSoftObjectPtr<USeinFaction>> GetAvailableFactionsFiltered(const TArray<TSoftObjectPtr<USeinFaction>>& Allowlist) const;Register Runtime Faction
Section titled “Register Runtime Faction”Adds a faction created at runtime, such as a player-designed or downloaded one, and fires On Factions Changed. Its Faction ID must be unique; the service does not check. Adding the same faction twice does nothing.
void RegisterRuntimeFaction(USeinFaction* Faction);Unregister Runtime Faction
Section titled “Unregister Runtime Faction”Remove a previously-registered runtime faction. AssetRegistry-discovered factions cannot be unregistered through this path — use the asset delete flow. Triggers OnFactionsChanged.
void UnregisterRuntimeFaction(USeinFaction* Faction);Refresh From Asset Registry
Section titled “Refresh From Asset Registry”Rescans the asset registry for Sein Faction assets and fires On Factions Changed. The service already scans at startup and when the asset registry finishes loading, so call this only after faction assets are added at runtime.
void RefreshFromAssetRegistry();Event dispatchers
Section titled “Event dispatchers”On Factions Changed BP
Section titled “On Factions Changed BP”FOnFactionsChangedDynamic OnFactionsChangedBP
Fires when the known factions change: after a rescan or a runtime register or unregister. Bind it to rebuild faction pickers.