# GetPositions

> Get the positions of all vertices in the trail.

## Definition

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

## GetPositions(Vector3\[])

Get the positions of all vertices in the trail.

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

### Parameters

**** (\[Vector3\[]]\(/engine/6000.0/script-reference/unityengine/vector3)): The array of positions to retrieve.

### 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 [TrailRenderer.GetPosition](/engine/6000.0/script-reference/unityengine/trailrenderer/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: [TrailRenderer.positionCount](/engine/6000.0/script-reference/unityengine/trailrenderer/positioncount.md) property.

Additional Resources: [TrailRenderer.GetPosition](/engine/6000.0/script-reference/unityengine/trailrenderer/getposition.md) function.

## GetPositions(NativeArray\<Vector3>)

Get the positions of all vertices in the trail.

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

### Parameters

**** (\[NativeArray\<Vector3>]\(/engine/6000.0/script-reference/unity/collections/nativearray1)): The array of positions to retrieve.

### 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 [TrailRenderer.GetPosition](/engine/6000.0/script-reference/unityengine/trailrenderer/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: [TrailRenderer.positionCount](/engine/6000.0/script-reference/unityengine/trailrenderer/positioncount.md) property.

Additional Resources: [TrailRenderer.GetPosition](/engine/6000.0/script-reference/unityengine/trailrenderer/getposition.md) function.

## GetPositions(NativeSlice\<Vector3>)

Get the positions of all vertices in the trail.

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

### Parameters

**** (\[NativeSlice\<Vector3>]\(/engine/6000.0/script-reference/unity/collections/nativeslice1)): The array of positions to retrieve.

### 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 [TrailRenderer.GetPosition](/engine/6000.0/script-reference/unityengine/trailrenderer/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: [TrailRenderer.positionCount](/engine/6000.0/script-reference/unityengine/trailrenderer/positioncount.md) property.

Additional Resources: [TrailRenderer.GetPosition](/engine/6000.0/script-reference/unityengine/trailrenderer/getposition.md) function.
