通过脚本创建纹理时使用的格式。
using UnityEngine;
public class Example : MonoBehaviour { void Start() { // Create a new alpha-only texture and assign it // to the renderer's material Texture2D texture = new Texture2D(128, 128, TextureFormat.Alpha8, false); GetComponent<Renderer>().material.mainTexture = texture; } }
Note that not all graphics cards support all texture formats, use SystemInfo.SupportsTextureFormat to check. Also, only the Texture2D class supports texture creation from script with Crunch compression texture formats.
另请参阅:Texture2D、texture assets。
Alpha8 | 纯 Alpha 纹理格式,8 位整数。 |
ARGB4444 | 16 位/像素纹理格式。纹理存储具有 Alpha 通道的颜色。 |
RGB24 | 颜色纹理格式,每通道 8 位。 |
RGBA32 | 具有 Alpha 纹理格式的颜色,每通道 8 位。 |
ARGB32 | 具有 Alpha 纹理格式的颜色,每通道 8 位。 |
RGB565 | 16 位颜色纹理格式。 |
R16 | 单通道 (R) 纹理格式,16 位整数。 |
DXT1 | 压缩颜色纹理格式。 |
DXT5 | 具有 Alpha 通道纹理格式的压缩颜色。 |
RGBA4444 | 颜色和 Alpha 纹理格式,每通道 4 位。 |
BGRA32 | 具有 Alpha 纹理格式的颜色,每通道 8 位。 |
RHalf | 标量 (R) 纹理格式,16 位浮点值。 |
RGHalf | 双色 (RG) 纹理格式,每通道 16 位浮点值。 |
RGBAHalf | RGB 颜色和 Alpha 纹理格式,每通道 16 位浮点值。 |
RFloat | 标量 (R) 纹理格式,32 位浮点值。 |
RGFloat | 双色 (RG) 纹理格式,每通道 32 位浮点值。 |
RGBAFloat | RGB 颜色和 Alpha 纹理格式,每通道 32 位浮点值。 |
YUY2 | 使用 YUV 颜色空间的格式,此格式通常用于视频编码或播放。 |
RGB9e5Float | RGB HDR 格式,具有每通道 9 位尾数和 5 位共享指数。 |
BC4 | 压缩单通道 (R) 纹理格式。 |
BC5 | 压缩双通道 (RG) 纹理格式。 |
BC6H | HDR 压缩颜色纹理格式。 |
BC7 | 高品质压缩颜色纹理格式。 |
DXT1Crunched | 使用 Crunch 压缩的压缩颜色纹理格式,适用于较小的存储大小。 |
DXT5Crunched | 使用 Crunch 压缩的具有 Alpha 通道纹理格式的压缩颜色,适用于较小的存储大小。 |
PVRTC_RGB2 | PowerVR (iOS) 2 位/像素压缩颜色纹理格式。 |
PVRTC_RGBA2 | PowerVR (iOS) 2 位/像素压缩,具有 Alpha 通道纹理格式。 |
PVRTC_RGB4 | PowerVR (iOS) 4 位/像素压缩颜色纹理格式。 |
PVRTC_RGBA4 | PowerVR (iOS) 4 位/像素压缩,具有 Alpha 通道纹理格式。 |
ETC_RGB4 | ETC (GLES2.0) 4 位/像素压缩 RGB 纹理格式。 |
EAC_R | ETC2 / EAC (GL ES 3.0) 4 位/像素压缩无符号单通道纹理格式。 |
EAC_R_SIGNED | ETC2 / EAC (GL ES 3.0) 4 位/像素压缩有符号单通道纹理格式。 |
EAC_RG | ETC2 / EAC (GL ES 3.0) 8 位/像素压缩无符号双通道 (RG) 纹理格式。 |
EAC_RG_SIGNED | ETC2 / EAC (GL ES 3.0) 8 位/像素压缩有符号双通道 (RG) 纹理格式。 |
ETC2_RGB | ETC2 (GL ES 3.0) 4 位/像素压缩 RGB 纹理格式。 |
ETC2_RGBA1 | ETC2 (GL ES 3.0) 4 位/像素 RGB+1 位 Alpha 纹理格式。 |
ETC2_RGBA8 | ETC2 (GL ES 3.0) 8 位/像素压缩 RGBA 纹理格式。 |
ASTC_4x4 | ASTC(4x4 像素块,128 位)压缩 RGB(A) 纹理格式。 |
ASTC_5x5 | ASTC(5x5 像素块,128 位)压缩 RGB(A) 纹理格式。 |
ASTC_6x6 | ASTC(6x6 像素块,128 位)压缩 RGB(A) 纹理格式。 |
ASTC_8x8 | ASTC(8x8 像素块,128 位)压缩 RGB(A) 纹理格式。 |
ASTC_10x10 | ASTC(10x10 像素块,128 位)压缩 RGB(A) 纹理格式。 |
ASTC_12x12 | ASTC(12x12 像素块,128 位)压缩 RGB(A) 纹理格式。 |
RG16 | 双色 (RG) 纹理格式,每通道 8 位。 |
R8 | 单通道 (R) 纹理格式,8 位整数。 |
ETC_RGB4Crunched | 使用 Crunch 压缩的压缩颜色纹理格式,适用于较小的存储大小。 |
ETC2_RGBA8Crunched | 使用 Crunch 压缩的具有 Alpha 通道纹理格式的压缩颜色,适用于较小的存储大小。 |
ASTC_HDR_4x4 | ASTC(4x4 像素块,128 位)压缩 RGB(A) HDR 纹理格式。 |
ASTC_HDR_5x5 | ASTC(5x5 像素块,128 位)压缩 RGB(A) HDR 纹理格式。 |
ASTC_HDR_6x6 | ASTC(6x6 像素块,128 位)压缩 RGB(A) HDR 纹理格式。 |
ASTC_HDR_8x8 | ASTC(8x8 像素块,128 位)压缩 RGB(A) 纹理格式。 |
ASTC_HDR_10x10 | ASTC(10x10 像素块,128 位)压缩 RGB(A) HDR 纹理格式。 |
ASTC_HDR_12x12 | ASTC(12x12 像素块,128 位)压缩 RGB(A) HDR 纹理格式。 |
RG32 | Two channel (RG) texture format, 16 bit integer per channel. |
RGB48 | Three channel (RGB) texture format, 16 bit integer per channel. |
RGBA64 | Four channel (RGBA) texture format, 16 bit integer per channel. |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.