Format
typescript
Texture.widthclass: Texture
Description
The width of the texture in pixels.
The width of the texture represents the number of pixels in the horizontal direction. Read-only.
Parameters
| param_name | type | description |
|---|
Return
| type | description |
|---|---|
number | The width of the texture. |
Code Example
typescript
let uuid = "31A9092E126B4B19BBFD9D5FCD75AA49";
let tex = Resources.Load<Texture>(Texture, uuid);
if (tex == null) {
throw new Exception("failed to load texture2d: " + uuid);
}
Debug.Log("Texture width is: ", tex.width);