Character Pipeline
All CrimsonCore characters share a common init-state machine driven by UCrimsonPawnExtensionComponent. No actor hardcodes attribute sets in its constructor — they are always granted dynamically via UCrimsonAbilitySet data assets.
Init-state machine
| State | Gate condition | What triggers it |
|---|---|---|
Spawned | Always — set immediately on spawn | Actor is created and components initialize |
DataAvailable | PawnData is set (replicated from PlayerState or injected by GameMode) | UCrimsonPawnExtensionComponent::SetPawnData() called |
DataInitialized | All sibling components have also reached DataAvailable | Each component calls CheckDefaultInitialization() |
GameplayReady | ASC is initialized and the pawn is possessed | UCrimsonHeroComponent or NPC controller completes setup |
Attribute set grant order
Attribute sets must be granted before any component that reads from them is initialized. The rule is strict: grant first, initialize health component second.
| Actor | When sets are granted | When health component initializes |
|---|---|---|
ACrimsonPlayerState | SetPawnData() — after experience loads | N/A — PlayerState has no health component; the pawn's health component reads this ASC |
ACrimsonNPCBase | SetNPCData() — called by spawner after spawn | End of SetNPCData() |
ACrimsonSummonBase | InitializeSummon() — on possession by summon controller | End of InitializeSummon() |
ACrimsonCharacter (player pawn) | UCrimsonHeroComponent::InitializeAbilitySystem() | Inside UCrimsonHeroComponent |
NPC object pool
When ACrimsonNPCBase::DeactivateForPooling() is called, the health component is uninitialized before ability set handles are torn down. This prevents stale delegate callbacks from firing on a pooled actor. On reactivation, SetNPCData() re-grants the sets and re-initializes the health component.
Per-actor attribute defaults
To give a specific NPC different starting health without a separate Gameplay Effect, use the DefaultValues array on FCrimsonAbilitySet_AttributeSet in CrimsonCommon:
DA_AbilitySet_Goblin_BossGrantedAttributes[0].AttributeSet = UCrimsonHealthSetGrantedAttributes[0].DefaultValues[0].Attribute = UCrimsonHealthSet.MaxHealthGrantedAttributes[0].DefaultValues[0].Value = 500GrantedAttributes[0].DefaultValues[1].Attribute = UCrimsonHealthSet.HealthGrantedAttributes[0].DefaultValues[1].Value = 500