Skip to main content

Texture2D.SetPixels(Color[] colors, number miplevel = 0)

Sets the pixel colors of an entire mipmap level.

Parameters:

NameTypeDescription
colorsColor[]The array of pixel colours to use. This is a 2D image flattened to a 1D array.
miplevelnumberThe mipmap level to write colors to. The range is 0 through the texture's Texture.mipmapCount. The default value is 0.

Usage

---@type Texture2D
local texture2d;

---@type Color
local colors;

---@type number
local miplevel;


texture2d.SetPixels(colors, miplevel)

Extra Detail

This method sets pixel data for the texture in CPU memory. Texture.isReadable must be true, and you must call Apply after SetPixels to upload the changed pixels to the GPU.