Skip to content

Format

typescript
RenderTexture.GetPixel(x, y, mipLevel)

class: RenderTexture

Description

Get the pixel color at coordinates (x, y).

Parameters

param_nametypedescription
xnumberx-axis coordinate
ynumbery-axis coordinate
mipLevelnumbermipmap level

Return

typedescription
ColorPixel color

Code Example

typescript
function Test() {
    try {
        let temp_texture = RenderTexture.GetTemporary(100, 100, RenderTextureFormat.Default, DepthType.Depth24Stencil8, AntiAliasingLevel.x8);
        let pixel = temp_texture.GetPixel(10,20,1)
    } catch (error) {
        Debug.Log(error);
    }
}