# Unit.getId

Returns the id of a unit.

**Kind:** Function

**Environments:** Game

## Game

``` { .lua .api-signature }
unit:getId(  )
```

[Open the full Game reference](../Game-Script-Environment/Userdata/Unit.md#getid)

**Availability:** Server only

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `unit` | [Unit](../Game-Script-Environment/Userdata/Unit.md) | The unit. |

**Returns:**

| Type | Description |
| --- | --- |
| integer | The unit's id. |
