Respawn reference
The component that runs a unit’s death-to-respawn flow, the respawn points in the scene, and the rules asset that sets delay, place, health and penalties. For how to use it, see Respawn.
VtUnitRespawn
Component. Add it with Add Component → Vantage → Respawn → VtUnitRespawn. Adds VtUnitStats automatically.
Runs a unit’s death-to-respawn flow by its VtRespawnRules: waits the delay, picks the place, applies the XP and durability penalties, moves the unit there and revives it. Attached by VtUnit when the definition has rules.
Inspector fields
| Field | Type | Default | Description |
|---|---|---|---|
Rules (rules) |
VtRespawnRules | None | Delay, place, health and penalties. Required. |
Scripting API
| Member | Description |
|---|---|
bool IsWaiting { get; } |
True between death and respawn. |
float SecondsRemaining { get; } |
Seconds until Respawn is allowed; 0 when ready or alive. |
bool CanRespawnNow { get; } |
True when dead and the delay has passed. |
bool HasCheckpoint { get; } |
True once SetCheckpoint has been called. |
Vector3 Checkpoint { get; } |
The last checkpoint position. |
Vector3 DeathPosition { get; } |
Where the unit last died. |
event Action<float> OnDeathStarted |
Fires when the unit dies and the wait begins. Arg: seconds until respawn is allowed. |
event Action OnRespawnReady |
Fires once when the delay has passed on non-automatic rules. |
event Action<Vector3> OnRespawned |
Fires after the unit was moved and revived. Arg: where it came back. |
void Initialize() |
Cache siblings and subscribe to the death event. Idempotent; public for the late-attach path. |
void Tick(float deltaTime) |
Advance the respawn delay. Runs on the authority only. |
bool Respawn() |
Bring the unit back now. Refused while alive or before the delay has passed. On a predicting client the request is forwarded and this returns false. |
void SetCheckpoint(Vector3 position) |
Remember position for VtRespawnMode.Checkpoint rules. |
void ApplyRespawnStateFromNet(bool isWaiting, float seconds, Vector3 diedAt, bool checkpointSet, Vector3 checkpointPosition) |
Replace the wait and checkpoint state. Used by loading and replication; not authority-gated. |
VtRespawnPoint
Component. Add it with Add Component → Vantage → Respawn → VtRespawnPoint.
A place units come back to life. Drop one in the scene per graveyard, shrine or base. VtUnitRespawn picks the nearest point that accepts the unit’s faction, or a specific one by id.
Inspector fields
| Field | Type | Default | Description |
|---|---|---|---|
Id (id) |
string |
Empty | Stable id for Fixed Point respawn rules. Optional; convention: ‘respawn.’. |
Factions (factions) |
VtFaction[] | Empty | Factions this point serves. Empty = every faction. |
Gizmo Color (gizmoColor) |
Color |
#4CFF8099 |
Color of the editor gizmo drawn when this point is selected. |
Scripting API
| Member | Description |
|---|---|
static IReadOnlyList<VtRespawnPoint> All { get; } |
Every enabled point in the scene. |
static VtRespawnPoint Find(string id) |
The enabled point with id, or null. |
static VtRespawnPoint Nearest(Vector3 from, VtFaction faction) |
The closest enabled point on the ground plane that accepts faction, or null when none does. |
bool Accepts(VtFaction faction) |
True when this point serves faction. |
void Register() |
Add this point to the scene registry. Idempotent; public for late-attach callers. |
VtRespawnRules
Asset. Create it with Create → Vantage → Respawn → Respawn Rules.
What happens after a unit dies: how long it waits, where it comes back, with how much health, and what it loses. Assign to VtUnitDefinition.respawnRules; VtUnit attaches a VtUnitRespawn that runs the flow. One asset usually serves every player; monsters use spawners instead.
Inspector fields
| Field | Type | Default | Range | Description |
|---|---|---|---|---|
Delay Seconds (delaySeconds) |
float |
5 | ≥ 0 | Seconds between death and the earliest respawn. Counts in simulation time. |
Automatic (automatic) |
bool |
On | Respawn as soon as the delay is over. Uncheck to wait for VtUnitRespawn.Respawn from your UI, for a ‘release’ button. | |
Mode (mode) |
VtRespawnMode | NearestPoint |
Where the unit comes back. | |
Point Id (pointId) |
string |
Empty | Id of the VtRespawnPoint to use in Fixed Point mode. Falls back to the nearest point. | |
Revive Hp Fraction (reviveHpFraction) |
float |
0.5 | 0 to 1 | Health on respawn as a fraction of maximum. Never below 1 HP. |
Xp Loss Fraction (xpLossFraction) |
float |
0 | 0 to 1 | Fraction of the XP earned toward the next level that is lost. Never drops a level. |
Durability Loss Fraction (durabilityLossFraction) |
float |
0 | 0 to 1 | Fraction of each equipped item’s maximum durability worn off on respawn. For an item that copies were combined into (Durability Mode Uses), the fraction of one copy’s durability. |
Enums
VtFaction
Team or allegiance of a VtUnit. Units of different factions fight each other unless either is Neutral; AI targeting, splash damage and projectiles all respect it.
| Value | Description |
|---|---|
Neutral |
Unaffiliated or ambient — not targeted, not hostile. |
Player |
The local player and their summons / pets. |
Enemy |
Scripted hostile units (waves, bosses). |
Wildlife |
Passive NPCs (deer, rabbits) — flee when attacked, don’t aggro. |
VtRespawnMode
Where a respawning unit reappears.
| Value | Description |
|---|---|
NearestPoint |
The closest VtRespawnPoint that accepts the unit’s faction; where it died if there is none. |
FixedPoint |
The VtRespawnPoint named by VtRespawnRules.pointId; the nearest point if missing. |
Checkpoint |
The last position passed to VtUnitRespawn.SetCheckpoint; the nearest point before any is set. |
WhereDied |
Exactly where the unit died. |