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
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
|src||The source texture or RenderTargetIdentifier.|
|dst||The destination texture or RenderTargetIdentifier.|
|srcElement||The element in the source texture to copy from. For example, the CubemapFace in a Cubemap or the slice in a texture array. Set the value to
|srcMip||The mipmap level to copy from. The range is
|dstElement||The element in the source texture to copy to. For example, the CubemapFace in a Cubemap or the slice in a texture array. Set the value to
|dstMip||The mipmap level to write to. The range is
|srcX||The starting x coordinate of
|srcY||The starting y coordinate of
|srcWidth||The width of
|srcHeight||The height of
|dstX||The x coordinate of
|dstY||The y coordinate to
Adds a command to copy pixel data from one texture to another.
This method adds a command to copy pixel data from one texture to another on the GPU. If you set Texture.isReadable to
true for both
dst textures, the method also copies pixel data on the CPU.
If you set Texture.isReadable to
CopyTexture is one of the fastest ways to copy a texture. But to use
CopyTexture, the following must be the same in both the source and destination texture areas:
You might be able to copy between incompatible formats depending on your graphics API. For example, on some APIs you can copy between formats with the same bit width.
Depending on your graphics API, you might not be able to copy between different types of textures. For more information on compatibility, see SystemInfo.copyTextureSupport and CopyTextureSupport.
src is a depth-only render texture, you must copy the whole texture, not part of it. A depth-only render texture has its color buffer set to a color format of
None and its depth buffer set to a valid RenderTexture.depthStencilFormat.
Compressed texture formats add some restrictions to the CopyTexture with a region variant. For example, PVRTC formats are not supported since they are not block-based (for these formats you can only copy whole texture or whole mipmap level). For block-based formats (for instance, DXT, ETC), the region size and coordinates must be a multiple of compression block size (4 pixels for DXT).
Even if you set
Texture.isReadable to true, this method doesn't copy pixel data on the CPU if you copy only a region of a compressed texture.
See Also: Graphics.CopyTexture, CopyTextureSupport.