格式
typescript
Texture2D.SetPixel(x, y, col, mipLevel)所属类: Texture2D
描述
设置纹理上特定位置的像素颜色。
参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| x | number | x轴坐标 |
| y | number | y轴坐标 |
| col | Color | 像素颜色 |
| mipLevel | number | mip贴图级别 |
返回值
| 类型 | 描述 |
|---|---|
void |
代码示例
typescript
let tex = Resources.Load<Texture2D>(Texture2D, "texture2dID");
if (tex == null) {
throw new Exception("failed to load texture2d: " + "texture2dID");
}
tex.SetPixel(0, 0, Color.red, 0);