Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseFor some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Closecolors | The array of pixel colours to use. This is a 3D texture flattened to a 1D array. |
miplevel | The mipmap level to write colors to. The range is 0 through the texture's Texture.mipmapCount. The default value is 0 . |
Sets the pixel colors of an entire mipmap level.
This method sets pixel data for the texture in CPU memory. Texture.isReadable must be true
, and you must call Apply after SetPixels32
to upload the changed pixels to the GPU.colors
must contain the pixels slice by slice starting at the front of the texture. Each slice must contain the pixels row by row, starting at the bottom left of the texture. The size of the array must be the width × height × depth of the mipmap level.
A single call to SetPixels32
is usually faster than multiple calls to SetPixel, especially for large textures.SetPixels32
might be slower than some other texture methods because it converts the Color32 struct into the format the texture uses. To set pixel data more quickly, use SetPixelData instead.
You can use SetPixel32
with the following texture formats:
For all other formats, SetPixels32
fails. Unity throws an exception when SetPixels32
fails.
See Also: SetPixels, SetPixelData, GetPixels32, GetPixels, Apply, mipmapCount.