Vehicle Setup

Vehicle Health

To begin, add a Health component to the root transform of the vehicle.

Damageable Components

For each damageable component on the vehicle, add a Damageable component somewhere in the vehicle's hierarchy and customize its health properties in the inspector.

Colliders

For each game object that contains one or more colliders that represents a damageable component, add a Damage Receiver component and set the Damageable it refers to in the inspector.

Detonators

When the vehicle or an individual damageable component on it is destroyed, you may want to spawn effects such as explosions. The Detonator class helps you do that.

To set up a Detonator:

  1. If the detonator is for the whole vehicle, go to the Vehicle component and add the Detonator's Detonate function to its On Destroyed event.

  2. If the detonator is for the an individual damageable component, go to the Damageable component and add the Detonator's Detonate function to its On Destroyed event.

  3. Go to the inspector of the Detonator component, open the Detonated State Spawn Objects list, and add your explosion prefab there.

Last updated