# sm.ai.getClosestVisibleCrop

Returns the farming harvestable that is closest to the unit.

**Kind:** Function

**Environments:** Game

## Game

``` { .lua .api-signature }
sm.ai.getClosestVisibleCrop( unit )
```

[Open the full Game reference](../Game-Script-Environment/Static-Functions/sm.ai.md#getclosestvisiblecrop)

**Parameters:**

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

**Returns:**

| Type | Description |
| --- | --- |
| [Harvestable](../Game-Script-Environment/Userdata/Harvestable.md) | The harvestable. |
