Skip to content

Format

typescript
RenderTexture.SetPixel(x, y, col, mipLevel)

class: RenderTexture

Description

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

Parameters

param_nametypedescription
xnumberx-axis coordinate
ynumbery-axis coordinate
colColorpixel color
mipLevelnumbermipmap level

Return

typedescription
void

Code Example

typescript
function Test() {
    try {
        let temp_texture = RenderTexture.GetTemporary(100, 100, RenderTextureFormat.Default, DepthType.Depth24Stencil8, AntiAliasingLevel.x8);
        texture.SetPixel(0, 0, Color.red, 1);
    } catch (error) {
        Debug.Log(error);
    }
}