# Unit.addContainer

Creates and stores a container in the given index inside the unit.

**Kind:** Function

**Environments:** Game

## Game

``` { .lua .api-signature }
unit:addContainer( index, size, stackSize? )
```

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

**Availability:** Server only

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `unit` | [Unit](../Game-Script-Environment/Userdata/Unit.md) | The unit. |
| `index` | integer | The index of the container [0-15]. |
| `size` | integer | The number of slots in the container. |
| `stackSize` *(optional)* | integer | The stack size. Defaults to maximum possible stack size(65535). |

**Returns:**

| Type | Description |
| --- | --- |
| [Container](../Game-Script-Environment/Userdata/Container.md) | The created container. |
