Format
typescript
Texture2D.SetPixel(x, y, col, mipLevel)class: Texture2D
Description
Sets the color of a specific pixel at a given position on the texture.
Parameters
| param_name | type | description |
|---|---|---|
| x | number | The x-axis coordinate. |
| y | number | The y-axis coordinate. |
| col | Color | The color of the pixel. |
| mipLevel | number | The mip level of the texture. |
Return
| type | description |
|---|---|
void |
Code Example
typescript
let uuid = "31A9092E126B4B19BBFD9D5FCD75AA49";
let tex = Resources.Load<Texture2D>(Texture2D, uuid);
if (tex == null) {
throw new Exception("failed to load texture2d: " + uuid);
}
tex.SetPixel(0, 0, Color.red, 0);