# GetPixel(int, int)

> Gets the pixel color at coordinates ( x, y ).

## Definition

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

```csharp
public Color GetPixel(int x, int y)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The x coordinate of the pixel to get. The range is `0` through the (texture width - 1).**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The y coordinate of the pixel to get. The range is `0` through the (texture height - 1).

### Returns

| Type                                                          | Description      |
| ------------------------------------------------------------- | ---------------- |
| [Color](/engine/6000.0/script-reference/unityengine/color.md) | The pixel color. |

### Remarks

This method gets pixel data from the texture in CPU memory. [Texture.isReadable](/engine/6000.0/script-reference/unityengine/texture/isreadable.md) must be `true`.

The lower left corner is (0, 0). If the pixel coordinate is outside the texture's dimensions, Unity clamps or repeats it, depending on the texture's [TextureWrapMode](/engine/6000.0/script-reference/unityengine/texturewrapmode.md).

If you need to get a large block of pixels, it might be faster to use [WebCamTexture.GetPixels](/engine/6000.0/script-reference/unityengine/webcamtexture/getpixels.md).

**Note:** For depth data based WebCamTexture instances, the depth value (distance in meters) can be accessed using the [Color.r](/engine/6000.0/script-reference/unityengine/color/r.md) property. Additional Resources: [WebCamTexture.isDepth](/engine/6000.0/script-reference/unityengine/webcamtexture/isdepth.md).

Additional Resources: [WebCamTexture.GetPixels32](/engine/6000.0/script-reference/unityengine/webcamtexture/getpixels32.md), [WebCamTexture.GetPixels](/engine/6000.0/script-reference/unityengine/webcamtexture/getpixels.md).
