Skip to content

格式

typescript
Texture.width

所属类: Texture

描述

纹理的宽度(以像素为单位)。

纹理的宽度代表纹理在水平方向上的像素数量。 只读

参数

参数名类型描述

返回值

类型描述
number纹理的宽度

代码示例

typescript
let tex = Resources.Load<Texture>(Texture, "textureId");
if (tex == null) {
    throw new Exception("failed to load texture2d: " + uuid);
}
Debug.Log("Texture width is: ", tex.width);