格式
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);