Version: 2021.2
LanguageEnglish
  • C#

Texture3D.SetPixels

Suggest a change

Success!

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.

Close

Submission failed

For 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.

Close

Cancel

Switch to Manual

Declaration

public void SetPixels(Color[] colors, int miplevel);

Declaration

public void SetPixels(Color[] colors);

Parameters

colors The colors to set the pixels to.
miplevel The mipmap level to be affected by the new colors.

Description

Sets pixel colors of a 3D texture.

This function takes a color array and changes the pixel colors of the 3D texture. Call Apply to actually upload the changed pixels to the GPU.

Note that using Color32 data with ::SetPixels32 function can be faster and consume less memory. The array of pixels is ordered x, y, z. With for-loops have x in the centre, y in the middle and z on the outside to create the array of pixels.

SetPixels throws an exception when it fails.

See Also: GetPixel, GetPixelBilinear, GetPixels, GetPixels32, SetPixel, SetPixels32, Apply functions.