Health connects Attribute Manager values to damage, healing, death and respawn. Use Character Health for a UCC character and Health for ordinary objects.
In the editor
- Open Tools > Opsive > Ultimate Character Controller > Character Manager, assign Character, enable Health, and select Build Character or Update Character. This adds Character Attribute Manager, Character Health, and Character Respawner.
- In the Attribute Manager, configure the named Health entry’s bounds and starting value. The character default is value
100, minimum0, maximum100. Select that entry in Health Attribute. - For a separate shield, create a Shield attribute and select it in Shield Attribute.
- Add Die and its Animator transitions for a death animation. Add Ragdoll or Revive when needed; the Health option does not add these abilities.
- Configure Character Respawner for the return location and delay. Character Manager’s defaults are Start Location, scheduling on death, and a random delay of
2–3seconds; see Respawner.
For an ordinary object, add Attribute Manager and Health to the same GameObject, create the named attributes, and select them in Health. Add Respawner if the object should return. Character fall damage requires Character Health.
Health and shield
Damage consumes Shield before Health, stopping each at Min Value. IsAlive() remains true while either configured attribute exceeds its minimum. Healing fills Health first, then Shield; Heal returns false when no value changes.
| Field | Version 3 default | Use it for |
|---|---|---|
| Invincible | Disabled | Ignore normal damage while a state, cutscene, or gameplay rule protects the object. |
| Time Invincible After Spawn | 0 seconds |
Ignore normal damage for this duration after OnRespawn. Before the first respawn, Version 3 compares the value with time since application start. |
| Health Attribute | Health |
Select the primary Attribute Manager value. |
| Shield Attribute | (None) | Select an optional value that absorbs damage before Health. |
Keep Health’s automatic update at None unless it should regenerate. For Shield regeneration, choose Increase and configure delay, interval and amount; each value change restarts the delay. See Attributes.
Accepted damage applies hitbox scaling, attribute changes and force, then sends damage events and opens the optional popup. Force uses the character force interface or a non-kinematic Rigidbody. Zero damage, an already-dead object, Invincible and active spawn grace reject the request before those effects.
Hit locations
Expand Hitboxes, add a Collider, and set Damage Multiplier: 1 is unchanged, below 1 reduces damage, above 1 increases it. Max Hitbox Collision Count defaults to 10 for the fallback raycast. Test actual weapon impacts with their hit collider and nonzero direction. Multipliers apply to non-radius damage; explosions use radius damage without hitbox scaling.

Feedback and death
Audio > Take Damage, Heal, and Death select Audio Clip Sets; lethal damage plays Death audio. UI > Damage Popup Manager ID selects a registered monitor, or -1 for none. Character Health’s Damaged Effect and Damaged Effect Index select an existing character Effect. Give each response one owner when wiring Unity events and UCC listeners.
| Field | Version 3 default | Behavior |
|---|---|---|
| Spawned Objects On Death | Empty | Instantiates each prefab through the object pool at the object’s position and rotation. |
| Destroyed Objects On Death | Empty | Returns pooled objects to their pool or destroys ordinary objects. |
| Deactivate On Death | Disabled | Deactivates the object after Deactivate On Death Delay. |
| Deactivate On Death Delay | 0 seconds |
Delays deactivation when that option is enabled. Keep it shorter than the minimum respawn time. |
| Death Layer | None | Moves the object to a single layer while dead; Character Health also updates the locomotion collision layer. |
Death cancels Health/Shield regeneration and sends OnDeath for locomotion, abilities, inventory, camera, UI and Respawner listeners. OnRespawn restores the two attributes’ recorded starting values and the alive layer; Character Health also restores its collision layer. Another system must restore persistent objects spawned or destroyed on death. Healing alone does not perform this lifecycle: use Respawner or Revive.
Fall damage
Character Health receives character landing events. Enable its Fall Damage options for measured ledge heights:
| Field | Version 3 default | Behavior |
|---|---|---|
| Apply Fall Damage | Disabled | Enables damage when the reported fall height reaches the minimum. |
| Min Fall Damage Height | 3 |
Falls below this height do no damage. |
| Min Fall Damage | 1 |
Damage at the minimum height. |
| Max Fall Damage | 50 |
Damage just below Death Height. |
| Death Height | 20 |
A fall at or above this height sends infinite damage through the normal damage path. |
| Damage Curve | Linear | Maps the normalized distance between minimum height and death height to the range between minimum and maximum damage. |
The calculated amount uses the normal damage path, including immunity and spawn grace.
Verify in Play Mode
- Damage below Shield capacity should change only Shield; larger damage should reduce Health by the remainder. Heal should restore Health before Shield, and regeneration should respect its delay.
- Test each hitbox and radius impact, immunity and spawn grace. Rejected damage should produce no force, damage event or popup.
- Apply lethal damage and confirm one death response, the intended abilities/layer/objects and deactivation. Respawn should restore starting values, the alive layer and character control. Keep death deactivation earlier than the minimum respawn time.
- Test falls below, between and at the configured height thresholds.
Use from code
Use positive amounts. Damage(float) supplies no direction, force, attacker or collider; richer overloads and Damage(DamageData) carry that context. ImmediateDeath bypasses Invincible but still respects spawn grace in Version 3; invoke it after that grace period.
using UnityEngine;
using Opsive.UltimateCharacterController.Traits;
public class HealthCommands : MonoBehaviour
{
[SerializeField] private Health m_Health;
public void ApplyDamage(float amount)
{
if (amount > 0) {
m_Health.Damage(amount);
}
}
public bool ApplyHealing(float amount)
{
return amount > 0 && m_Health.Heal(amount);
}
public void KillImmediately()
{
m_Health.ImmediateDeath();
}
}
Listen for health events
Register on Health’s owning GameObject and unregister the same callbacks:
using UnityEngine;
using Opsive.Shared.Events;
public class HealthListener : MonoBehaviour
{
private void Awake()
{
EventHandler.RegisterEvent<float, Vector3, Vector3, GameObject, Collider>(
gameObject, "OnHealthDamage", OnDamage);
EventHandler.RegisterEvent<float>(gameObject, "OnHealthHeal", OnHeal);
EventHandler.RegisterEvent<Vector3, Vector3, GameObject>(gameObject, "OnDeath", OnDeath);
}
private void OnDamage(float amount, Vector3 position, Vector3 force, GameObject attacker, Collider hitCollider)
{
Debug.Log($"Damage remaining after Shield: {amount}");
}
private void OnHeal(float amount)
{
Debug.Log($"Health and Shield restored: {amount}");
}
private void OnDeath(Vector3 position, Vector3 force, GameObject attacker)
{
Debug.Log($"Killed by: {attacker}");
}
private void OnDestroy()
{
EventHandler.UnregisterEvent<float, Vector3, Vector3, GameObject, Collider>(
gameObject, "OnHealthDamage", OnDamage);
EventHandler.UnregisterEvent<float>(gameObject, "OnHealthHeal", OnHeal);
EventHandler.UnregisterEvent<Vector3, Vector3, GameObject>(gameObject, "OnDeath", OnDeath);
}
}
OnHealthDamage reports damage remaining after Shield absorption; OnHealthHeal reports the amount actually applied. OnHealthDamageWithData(DamageData) exposes callback-scoped context: copy needed values instead of retaining pooled data. OnRespawn resets health, layer and grace timing. Inspector Unity callbacks expose damage (amount, position, force, attacker), healing and death; their damage callback omits the hit collider and structured data. See Events and Event Names.
Related:
Character Creation · Damage Processor · Health Pickup · Damage Visualization