# UnitClass

A script class that is instanced for every [Unit](../Game-Script-Environment/Userdata/Unit.md) in the game.

**Kind:** API page

**Environments:** Game

## Game

[Open the full Game reference](../Game-Script-Environment/Classes/UnitClass.md)

A unit represents an AI controlling a [Character](../Game-Script-Environment/Userdata/Character.md).

The unit script only runs on the server side.

Can receive events sent with [sm.event.sendToUnit](../Game-Script-Environment/Static-Functions/sm.event.md#sendtounit).

### Fields

| Name | Type | Description |
| --- | --- | --- |
| `unit` | [Unit](../Game-Script-Environment/Userdata/Unit.md) | The [Unit](../Game-Script-Environment/Userdata/Unit.md) game object belonging to this class instance. |
| `storage` | [Storage](../Game-Script-Environment/Userdata/Storage.md) | A [Storage](../Game-Script-Environment/Userdata/Storage.md) object that can be used to store data for the next time loading this object after being unloaded. |
| `data` | any | Data from the "data" json element. |
| `params` | any | Parameter sent to [sm.unit.createUnit](../Game-Script-Environment/Static-Functions/sm.unit.md#createunit). |
