Texture2D.Compress 压缩


function Compress (highQuality : bool) : void

Description描述

Compress texture into DXT format.

压缩纹理成为DXT格式

Use this to compress textures generated at   runtime. Compressed textures use less graphics memory and are faster to   render.

使用它压缩实时产生的纹理,压缩过的纹理使用更少的显存并可以更快的被渲染

After compression, texture will be in DXT1 format if the   original texture had no alpha channel, and in DXT5 format if it had   alpha channel.

压缩后,如果这个纹理没有alpha通道那么就会是DXT1格式,如果有alpha通道则会是DXT5格式

Passing true for highQuality   parameter will dither the source texture during   compression, which helps to reduce compression artifacts but is slightly   slower.

传递 true 到 highQuality   则会在压缩过程中抖动源纹理,这样会提高压缩质量但是也会让压缩速度变慢

If the graphics card does not support compression   or the texture is already in compressed format, then Compress will do   nothing.

如果显卡不支持压缩或者纹理已经是压缩格式了,那么这个Compress将不会做任何事

In the Editor scripts, you probably want to   use EditorUtility.CompressTexture , which will compress using slower, but   higher quality DXT compression.

在编辑器中的脚本中您可能要使用EditorUtility.CompressTexture,压缩的较慢,但却是更高质量的DXT压缩。

参见: SetPixels 函数, EditorUtility.CompressTexture


,