GetPixel(int, int)
Gets the pixel color at coordinates ( x, y ).
Read time 1 minuteLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.AudioModule
public Color GetPixel(int x, int y)
Parameters
Returns
Type | Description |
|---|---|
| Color | The pixel color. |
Remarks
This method gets pixel data from the texture in CPU memory. Texture.isReadable must be .
trueThe 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.
If you need to get a large block of pixels, it might be faster to use WebCamTexture.GetPixels.
Note: For depth data based WebCamTexture instances, the depth value (distance in meters) can be accessed using the Color.r property. Additional Resources: WebCamTexture.isDepth.
Additional Resources: WebCamTexture.GetPixels32, WebCamTexture.GetPixels.