---
title: "addObstacles(_:)"
framework: gameplaykit
role: symbol
role_heading: Instance Method
path: "gameplaykit/gkmeshgraph/addobstacles(_:)"
---

# addObstacles(_:)

Adds new obstacles to the graph.

## Declaration

```swift
func addObstacles(_ obstacles: [GKPolygonObstacle])
```

## Parameters

- `obstacles`: An array of obstacle objects to be added to the graph.

## Discussion

Discussion Adding or removing obstacles does not update the graph. The GKMeshGraph class adds, removes, and arranges nodes to describe the navigable areas around obstacles only when you call the triangulate() method. Typically, you add or remove several obstacles, then call the triangulate() method to update the graph.

## See Also

### Working with Obstacles

- [obstacles](gameplaykit/gkmeshgraph/obstacles.md)
- [removeObstacles(_:)](gameplaykit/gkmeshgraph/removeobstacles(_:).md)
