# CreateConvexHulls

> Create PolygonGeometry.ConvexHull from the composition by iterating all the layers added to the composition in the layer order specified, applying each operation specified. A default vertex scale of _one is used here.

## Definition

* **Type:** Method
* **Namespace:** [Unity.U2D.Physics](/engine/6000.6/script-reference/unity/u2d/physics.md)
* **Assembly:** UnityEngine.PhysicsCore2DModule

## CreateConvexHulls(Allocator)

Create [PolygonGeometry.ConvexHull](/engine/6000.6/script-reference/unity/u2d/physics/polygongeometry/convexhull.md) from the composition by iterating all the layers added to the composition in the layer order specified, applying each operation specified. A default vertex scale of [\_one](/engine/6000.6/script-reference/unityengine/vector2/one.md) is used here.

```csharp
public NativeArray<PolygonGeometry.ConvexHull> CreateConvexHulls(Allocator allocator = Allocator.Temp)
```

### Parameters

**** (\[Allocator]\(/engine/6000.6/script-reference/unity/collections/allocator)): The memory allocator to use for the results. This can only be [Allocator.Temp](/engine/6000.6/script-reference/unity/collections/allocator/temp.md), [Allocator.TempJob](/engine/6000.6/script-reference/unity/collections/allocator/tempjob.md) or [Allocator.Persistent](/engine/6000.6/script-reference/unity/collections/allocator/persistent.md).

### Returns

| Type                                                                                          | Description                                                                                                                                                                                                     |
| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [NativeArray\<ConvexHull>](/engine/6000.6/script-reference/unity/collections/nativearray1.md) | A NativeArray containing the Polygon Geometry convex hull created from the composer. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty. |

## CreateConvexHulls(Vector2, Allocator)

Create [PolygonGeometry.ConvexHull](/engine/6000.6/script-reference/unity/u2d/physics/polygongeometry/convexhull.md) from the composition by iterating all the layers added to the composition in the layer order specified, applying each operation specified.

```csharp
public NativeArray<PolygonGeometry.ConvexHull> CreateConvexHulls(Vector2 vertexScale, Allocator allocator = Allocator.Temp)
```

### Parameters

**** (\[Vector2]\(/engine/6000.6/script-reference/unityengine/vector2)): The scaling to be applied to the composer vertices.**** (\[Allocator]\(/engine/6000.6/script-reference/unity/collections/allocator)): The memory allocator to use for the results. This can only be [Allocator.Temp](/engine/6000.6/script-reference/unity/collections/allocator/temp.md), [Allocator.TempJob](/engine/6000.6/script-reference/unity/collections/allocator/tempjob.md) or [Allocator.Persistent](/engine/6000.6/script-reference/unity/collections/allocator/persistent.md).

### Returns

| Type                                                                                          | Description                                                                                                                                                                                                     |
| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [NativeArray\<ConvexHull>](/engine/6000.6/script-reference/unity/collections/nativearray1.md) | A NativeArray containing the Polygon Geometry convex hull created from the composer. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty. |
