Version: 2021.2
public Color GetPixel (int x, int y);

参数

x X coordinate of the pixel to get.
y Y coordinate of the pixel to get.

返回

Color Pixel color at the requested coordinate.

描述

返回坐标 (x, y) 上的像素颜色。

If the pixel coordinates are out of bounds (larger than the width or height of the Texture or smaller than 0) Unity clamps or repeats the pixel coordinates. This result depends on the wrap mode of the Texture.

If you are reading a large block of pixels from the Texture, it may be faster to use GetPixels which returns a whole block of pixel colors.

注意:对于基于深度数据的 WebCamTexture 实例,可以使用 Color.r 属性来访问深度值(以米为单位的距离)。另请参阅:WebCamTexture.isDepth