> For the complete documentation index, see [llms.txt](https://giantgrey.gitbook.io/tileworldcreator-v4-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://giantgrey.gitbook.io/tileworldcreator-v4-documentation/api.md).

# API

## TileWorldCreatorManager class

<details>

<summary>AddCellsToLayer</summary>

```csharp
AddCellsToLayer(string _layerName, HashSet<Vector2> _cellPositions)
```

Add cells to a blueprint layer.

</details>

<details>

<summary>AddCellsToLayerByGuid</summary>

```csharp
AddCellsToLayerByGuid(string _layerGuid, HashSet<Vector2> _cellPositions)
```

Add cells to a blueprint layer by its layer guid.

</details>

<details>

<summary>RemoveCellsFromLayer</summary>

```csharp
RemoveCellsFromLayer(string _layerName, HashSet<Vector2> _cellPositions)
```

Remove cells from a blueprint layer.

</details>

<details>

<summary>ResetMap</summary>

```csharp
ResetMap()
```

Resets all blueprint layers (painted cells) and build layers.\
Should be used when using TWC at runtime on Start / Initialization before generating a new map.

</details>

<details>

<summary>ClearLayer</summary>

```csharp
ClearLayer(string _layerName)
```

Clear all cell positions from a blueprint layer.

</details>

<details>

<summary>FillLayer</summary>

```csharp
FillLayer(string _layerName)
```

Fill all cells from a blueprint layer.

</details>

<details>

<summary>GenerateCompleteMap</summary>

```csharp
GenerateCompleteMap()
```

Generates a complete map. Executes blueprint layer stack and build layer stack.

</details>

<details>

<summary>ExecuteBlueprintLayers</summary>

```csharp
ExecuteAllBlueprintLayers()
```

Executes blueprint layer stack.

</details>

<details>

<summary>ExecuteBuildLayers</summary>

```csharp
ExecuteAllBuildLayers(ExecutionMode)
```

Executes build layer stack. \ <mark style="color:orange;">ExecutionMode</mark>:\ <kbd>**Normal**</kbd>: Only rebuilds changes.\ <kbd>**FromScratch**</kbd>: Rebuilds complete map.

</details>

<details>

<summary>GetBlueprintLayer</summary>

```csharp
GetBlueprintLayer(string _layerName)
```

Returns a BueprintLayer object.

</details>

<details>

<summary>GetBuildLayer</summary>

```csharp
GetBuildLayer(string _layerName)
```

Returns a build layer object.

</details>

<details>

<summary>GetBuildLayerByGuid</summary>

```csharp
GetBuildLayerByGuid(string _layerGuid)
```

Returns a BuildLayer object.

</details>

<details>

<summary>GetRelativeGridPosition</summary>

```csharp
GetRelativeGridPosition(Vector3 _worldPosition)
```

Convert world position to grid position relative to the TileWorldCreator Manager transforms. Can be used in combination with **IsRelativePositionOverGrid**.

</details>

<details>

<summary>IsRelativePositionOverGrid</summary>

```csharp
IsRelativePositionOverGrid(Vector2 _relativePosition)
```

Returns true or false if position is over grid.

</details>

<details>

<summary>SetBlueprintLayerActiveState</summary>

```csharp
SetBlueprintLayerActiveState(string _layerName, bool _state)
```

Enable or disable a blueprint layer.

</details>

<details>

<summary>SetBuildLayerActiveState</summary>

```csharp
SetBuildLayerActiveState(string _layerName, bool _state)
```

Enable or disable a blueprint layer

</details>

<details>

<summary>GetCellPositionsInRadius</summary>

```csharp
HashSet<Vector2> GetCellPositionsInRadius(string layerName, Vector3 position, float radius)
```

Returns a HashSet\<Vector2> of all blueprint cell positions within radius from position.

</details>

<details>

<summary>GetBuildLayerTileDataFromPosition</summary>

```csharp
BuildLayer.TileData GetBuildLayerTileDataFromPosition(string _buildLayerName, Vector2 _position)
```

Returns a TileData object from position.

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://giantgrey.gitbook.io/tileworldcreator-v4-documentation/api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
