Zum Hauptinhalt springen

Component Setup and Activation

Choose Components​

ComponentState owned
USurvHealthComponentHealth, Armor and life/armor tags
USurvFoodComponentFood, Water and food tags
USurvStaminaComponentStamina, Fitness and movement/exhaustion tags
USurvTempComponentTemperature and heating/cooling tags

Each constructor enables component replication by default and disables per-frame ticking. Add them to your Pawn/Character, then invoke SetComponentActive on authority after the owner/world/subsystem is available. The PawnRef stored by activation is required by numerical mutation checks.

Blueprint children in Content may provide startup logic; inspect their graphs before assuming they call activation. The supplied C++ does not do that from BeginPlay.


Activate and Reset Deliberately​

SetComponentActive copies project settings, resets values/tags and subscribes to the corresponding subsystem pulse delegate. Health also binds the Pawn's OnTakeAnyDamage event. Food activates Hungry and Thirsty; Stamina starts Resting; Temperature starts Neutral.

SetComponentInactive unbinds updates and resets defaults. Health additionally unbinds damage, but does not explicitly clear the downed timer there. ResetToDefaults loads defaults without recreating every activation behavior; resetting Food returns it to Neutral even while still subscribed.

Do not attach these native components to a PlayerState expecting Inventory-style lookup: their owner cast and subsystem getters are Pawn-based. For respawn, initialize the new Pawn's components and rebind UI to them. See Health, Food, Stamina and Temperature.