# Damageable

The **Damageable** component represents a single damageable object with specific health properties. You can customize the health properties in the inspector.

A **Damageable** component has much the same functionality as the **Health** component, except that the **Health** component represents multiple Damageables, while a **Damageable** only represents itself.

### Toggle Damage

To toggle damage in the editor, you can check/uncheck the *Is Damageable* checkbox in the inspector of the **Damageable** component.

To toggle it during gameplay, use the following code:

```
// Make Damageable un-damageable
myDamageable.IsDamageable = false;

// Make Damageable damageable
myDamageable.IsDamageable = true;
```

### Toggle Healing

To toggle healing in the editor, you can check/uncheck the *Is Healable* checkbox in the inspector of the **Damageable** component.

To toggle it during gameplay, use the following code:

```
// Make Damageable un-healable
myDamageable.IsHealable = false;

// Make Damageable healable
myDamageable.IsHealable = true;
```

### Apply Damage

To apply damage to the Damageable, use the following code:

```
// Apply damage
myDamageable.Damage(damageValue, hitWorldPosition);
```

### Apply Healing

To apply healing to the Damageable, use the following code:

```
// Apply healing
myDamageable.Heal(healValue, hitWorldPosition);
```

### Destroy/Restore

To destroy or restore the Damageable, use the following code:

```
// Destroy Damageable
myDamageable.Destroy();

// Restore Damageable
myDamageable.Restore();
```

### Set Health

To set the health of a Damageable component, use the following code:

```
// Set health
myDamageable.SetHealth(someValue);
```

### Health Info

To query Damageable health information, you can use the following code:

```
// Get current health
float health = myDamageable.CurrentHealth;

// Get health capacity
float maxHealth = myDamageable.HealthCapacity

// Get current health fraction (0.0 to 1.0, useful for health bars)
float healthFraction = myDamageable.CurrentHealthFraction;
```
