Skip to main content

Texture2D.Apply(boolean updateMipmaps = true, boolean makeNoLongerReadable = false)

Copies changes you've made in a CPU texture to the GPU.

Parameters:

NameTypeDescription
updateMipmapsbooleanWhen the value is true, Unity recalculates mipmap levels, using mipmap level 0 as the source. The default value is true.
makeNoLongerReadablebooleanWhen the value is true, Unity deletes the texture in CPU memory after it uploads it to the GPU, and sets isReadable to false. The default value is false.

Usage

---@type Texture2D
local texture2d;

---@type boolean
local updateMipmaps;

---@type boolean
local makeNoLongerReadable;


texture2d.Apply(updateMipmaps, makeNoLongerReadable)

Extra Detail

For most types of textures, Unity can store a copy of the texture in both CPU and GPU memory. The CPU copy is optional. If the CPU copy exists, you can read from and write to the CPU copy more flexibly than the GPU copy, for example using GetPixels. But to render the updated texture, you must use Apply to copy it from the CPU to the GPU.