Revive plays a get-up animation and, when the character is dead, completes the respawn only after that animation finishes. Use it for an in-place second chance, an ally-triggered revival, or a nonlethal knockdown that should visibly stand up again.
Before you begin
- Add a Respawner component to the same GameObject. Revive reports an error without it and relies on it to restore Health and the character’s alive state.
- Keep the character active after death. Revive cannot start when the GameObject is inactive, so disable Health > Deactivate On Death for this flow.
- Use an Animator Controller with the Revive states, or add equivalent states to a custom controller. The supplied controller expects Revive’s Ability Index Parameter to be
5; at runtime Ability Int Data is0for the forward get-up and1for the backward get-up. - Place Revive above Ragdoll and Die in the regular ability list. Revive is not concurrent; that higher priority lets it stop those active death abilities before the get-up animation begins.
- Use the regular Respawner flow instead when the character should disappear and return at a checkpoint without a get-up animation.
Configure an automatic in-place revive
- Select the character and open Ultimate Character Locomotion.
- Expand Abilities, select +, and add Revive.
- Move Revive above Ragdoll and Die. Its position in this list controls runtime priority; it is separate from the Ability Index Parameter field.
- Keep Start Type set to Manual and Stop Type set to Manual. The death callback starts the ability, and the animation-complete event stops it.
- Keep State set to Death and Ability Index Parameter set to
5when using the supplied Animator Controller. - Enable Start On Death. The Version 3 source default is disabled, although the supplied demo character enables it for its death-animation setup.
- Set Death Start Delay. The source default is
3seconds; this delay applies only when Start On Death schedules the revive. - On Health, clear Deactivate On Death so the delayed ability can still start.
- Enter Play Mode once and inspect Respawner. When Revive is enabled with Start On Death at startup, it changes Positioning Mode to None and disables Schedule Respawn On Death and Schedule Respawn On Disable. This prevents a normal timed respawn from racing the get-up animation.
Do not enable a second automatic respawn path for the same death. Revive intentionally keeps the current transform and calls Respawner itself at the end of the animation.
Choose the revival flow
Automatic second chance
Enable Start On Death for a character that should stand up automatically after Death Start Delay. This is the simplest in-place flow and lets Revive configure Respawner during Awake.
Player, ally, or environment trigger
Leave Start On Death disabled and start Revive from gameplay code when the interaction succeeds. For a genuinely dead character, keep the GameObject active, disable Schedule Respawn On Death, and choose the intended Positioning Mode before starting the ability. Use None to get up where the character fell.
Starting Revive while the character is still alive plays and stops the get-up ability but does not call Respawner.Respawn(). This is useful for a nonlethal knockdown, but the Death State still becomes active while the ability runs.
Changing Start On Death or Enabled after Awake does not automatically reconfigure Respawner. Update the Respawner settings at the same time when switching revival modes at runtime.
Death animation or ragdoll
Revive can follow either Die or Ragdoll. On death, those abilities may remain active; when the delayed Revive starts from a higher list position, it force-stops the lower-priority death ability. Stopping Die restores the character colliders. Stopping Ragdoll restores the animated hierarchy, disables its physics bodies, and re-enables the Animator before the get-up state plays.
The built-in forward/backward choice uses the death hit position relative to the character, not the ragdoll’s final resting pose. Test both directions when using physics-driven deaths and customize the revive type if the final pose needs a different animation.
How it runs
- Health reaches its minimum and sends
OnDeathwith the hit position, force, and attacker. - Ultimate Character Locomotion marks the character dead and stops abilities that are not allowed to remain active on death. Revive, Die, and Ragdoll are allowed to participate in the death flow.
- When Start On Death is enabled, Revive selects an Animator type from the hit position and schedules
StartAbility()after Death Start Delay. - The delayed start succeeds only if Revive is enabled, the GameObject is active in the hierarchy, and no higher-priority non-concurrent ability blocks it.
- Revive activates the Death State and sets Ability Index to
5. A hit in front of the character produces Ability Int Data0; a hit behind or at the character produces1. - The Animator plays the matching get-up animation. The included forward and backward clips send
OnAnimatorReviveCompletenear the end of the clip. - That event stops Revive. If the character is still dead, Revive immediately refreshes the Animator ability parameters and calls
Respawner.Respawn(). - Respawner sends
OnWillRespawn, performs any configured positioning, and then sendsOnRespawn. Health resets its Health and Shield attributes, Ultimate Character Locomotion becomes alive, and Die stops if it is still active.
There is no duration fallback in Revive. The completion animation event is what advances a dead character from the get-up animation to the respawn cleanup.
Verify in Play Mode
- Temporarily set Death Start Delay to
1so the sequence is easy to repeat. - Keep the Ultimate Character Locomotion, Health, Respawner, and Animator parameter views visible.
- Apply lethal damage from in front of the character. Confirm Alive becomes false, the death ability runs for the delay, Revive becomes the active regular ability, Ability Index becomes
5, and Ability Int Data becomes0. - Confirm any active Die or Ragdoll ability stops before the get-up animation begins.
- Let the animation complete. Confirm Revive stops once,
OnRespawnis sent once, Health returns to its starting value, Alive becomes true, and the character remains at the death location. - Repeat with the hit position behind the character and confirm Ability Int Data becomes
1and the backward get-up state plays. - If Ragdoll is enabled, repeat on uneven ground and verify the blend into each get-up animation is acceptable.
- Test a manual revival with Start On Death disabled. Confirm no normal Respawner timer completes first and the interaction starts Revive only when intended.
Troubleshooting
| Symptom | Check | Fix |
|---|---|---|
| The console says Revive requires Respawner | The character has no Respawner on its root GameObject. | Add Respawner before entering Play Mode. |
| The character respawns before the get-up animation | Schedule Respawn On Death is still enabled, Revive was disabled at startup, or Start On Death was enabled only after Awake. |
Use one respawn path. Disable ordinary scheduling and use Positioning Mode > None for an in-place revive. |
| Revive never starts after the delay | The GameObject was deactivated, Revive is disabled, or Die/Ragdoll has higher list priority. | Clear Deactivate On Death, enable Revive, and move it above the active death abilities. |
| The get-up animation starts but the character remains dead | The clip never sends OnAnimatorReviveComplete. |
Add an Animation Event near the end that calls ExecuteEvent with OnAnimatorReviveComplete as its string data. |
| The wrong forward/backward animation plays | The choice is based on the death hit position in the character’s local Z direction, not force direction or final ragdoll pose. | Verify the damage position, or override GetReviveTypeIndex for the game’s pose rules. |
| The character teleports after standing | A manual flow uses Start Location or Spawn Point positioning. | Set Positioning Mode to None, or use a normal respawn rather than an in-place Revive. |
| Revive starts but another ability or item remains visually active | Revive is below that regular ability, or the custom death setup does not respond to death/respawn events. | Move Revive higher and verify the other system handles OnDeath, OnWillRespawn, or OnRespawn. |
| Custom get-up state never exits | Its conditions do not match the ability parameters, or its clip lacks the completion event. | Use Ability Index 5, the intended Ability Int Data value, and the required completion event. |
Related tasks
- Die plays the standard forward or backward death animation.
- Ragdoll uses physics for the death pose and must yield before Revive animates.
- Health sends the death event and restores attributes on respawn.
- Respawner owns positioning and the final respawn events.
- Animator Controller explains the controller structure used by abilities.
- Replacing Animations covers changing supplied clips safely.
- State System can switch between automatic revive, death animation, and ragdoll configurations.
- Abilities explains list priority, start types, and Animator parameters.
Developer reference
Revive defaults to Manual start, Manual stop, State Death, and Ability Index Parameter 5. StartOnDeath defaults to false, DeathStartDelay defaults to 3, the ability is non-concurrent, and CanStayActivatedOnDeath is true.
Its public configuration properties are StartOnDeath and DeathStartDelay. AbilityIntData exposes the selected revive type. GetReviveTypeIndex(Vector3 position, Vector3 force, GameObject attacker) is the protected extension point for additional get-up choices.
Revive consumes OnDeath and OnAnimatorReviveComplete. When the character is still dead, completion causes Respawner to send OnWillRespawn and OnRespawn; activation also uses the standard OnCharacterAbilityActive event. Revive does not send a separate revival event.
Add another get-up animation
Subclass Revive and return an unused Ability Int Data value. This example selects type 3 for deaths caused by an attacker tagged Human while retaining the built-in forward/backward selection for every other death:
using Opsive.UltimateCharacterController.Character.Abilities;
using UnityEngine;
[System.Serializable]
public class MyReviveAbility : Revive
{
protected override int GetReviveTypeIndex(Vector3 position, Vector3 force, GameObject attacker)
{
if (attacker != null && attacker.CompareTag("Human")) {
return 3;
}
return base.GetReviveTypeIndex(position, force, attacker);
}
}
In the Full Body Layer’s Revive sub-state machine, add a state whose transition requires Ability Index 5 and Ability Int Data 3. Add the same ExecuteEvent / OnAnimatorReviveComplete Animation Event near the end of the new clip so Respawner performs its cleanup.
