# GetPositions

> Get the positions of all vertices in the line.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.3/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

## GetPositions(Vector3\[])

Get the positions of all vertices in the line.

```csharp
public int GetPositions(Vector3[] positions)
```

### Parameters

**** (\[Vector3\[]]\(/engine/6000.3/script-reference/unityengine/vector3)): The array of positions to retrieve. The array passed should be of at least [LineRenderer.positionCount](/engine/6000.3/script-reference/unityengine/linerenderer/positioncount.md) in size.

### Returns

| Type                                                       | Description                                                  |
| ---------------------------------------------------------- | ------------------------------------------------------------ |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | How many positions were actually stored in the output array. |

### Remarks

This method is preferred to [LineRenderer.GetPosition](/engine/6000.3/script-reference/unityengine/linerenderer/getposition.md) when retrieving all positions, as it is more efficient to get all positions using a single command than to get each position individually.

Additional Resources: [LineRenderer.positionCount](/engine/6000.3/script-reference/unityengine/linerenderer/positioncount.md) property, [LineRenderer.GetPosition](/engine/6000.3/script-reference/unityengine/linerenderer/getposition.md) function.

## GetPositions(NativeArray\<Vector3>)

Get the positions of all vertices in the line.

```csharp
public int GetPositions(NativeArray<Vector3> positions)
```

### Parameters

**** (\[NativeArray\<Vector3>]\(/engine/6000.3/script-reference/unity/collections/nativearray1)): The array of positions to retrieve. The array passed should be of at least [LineRenderer.positionCount](/engine/6000.3/script-reference/unityengine/linerenderer/positioncount.md) in size.

### Returns

| Type                                                       | Description                                                  |
| ---------------------------------------------------------- | ------------------------------------------------------------ |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | How many positions were actually stored in the output array. |

### Remarks

This method is preferred to [LineRenderer.GetPosition](/engine/6000.3/script-reference/unityengine/linerenderer/getposition.md) when retrieving all positions, as it is more efficient to get all positions using a single command than to get each position individually.

Additional Resources: [LineRenderer.positionCount](/engine/6000.3/script-reference/unityengine/linerenderer/positioncount.md) property, [LineRenderer.GetPosition](/engine/6000.3/script-reference/unityengine/linerenderer/getposition.md) function.

## GetPositions(NativeSlice\<Vector3>)

Get the positions of all vertices in the line.

```csharp
public int GetPositions(NativeSlice<Vector3> positions)
```

### Parameters

**** (\[NativeSlice\<Vector3>]\(/engine/6000.3/script-reference/unity/collections/nativeslice1)): The array of positions to retrieve. The array passed should be of at least [LineRenderer.positionCount](/engine/6000.3/script-reference/unityengine/linerenderer/positioncount.md) in size.

### Returns

| Type                                                       | Description                                                  |
| ---------------------------------------------------------- | ------------------------------------------------------------ |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | How many positions were actually stored in the output array. |

### Remarks

This method is preferred to [LineRenderer.GetPosition](/engine/6000.3/script-reference/unityengine/linerenderer/getposition.md) when retrieving all positions, as it is more efficient to get all positions using a single command than to get each position individually.

Additional Resources: [LineRenderer.positionCount](/engine/6000.3/script-reference/unityengine/linerenderer/positioncount.md) property, [LineRenderer.GetPosition](/engine/6000.3/script-reference/unityengine/linerenderer/getposition.md) function.
