Texture2D
extends Texture
The Texture2D class provides a series of methods for reading and modifying texture data.
javascript
let uuid = "31A9092E126B4B19BBFD9D5FCD75AA49";
let tex = Resources.Load<Texture2D>(Texture2D, uuid);
if (tex == null){
throw new Exception("failed to load texture2d: " + uuid);
}Instance Method
Texture2D.ReleaseCPUMemory ( ) : void |
| Release CPU memory |
Texture2D.GetPixel ( x : number , y : number , mipLevel : number ) : Color |
| Get the color of a specific pixel on a texture. |
Texture2D.GetPixels ( x : number , y : number , blockWidth : number , blockHeight : number , mipLevel : number? ) : Color|undefined [] |
| Get the pixel color of a specific area on a texture. |
Texture2D.SetPixel ( x : number , y : number , col : Color , mipLevel : number ) : void |
| Sets the color of a specific pixel at a given position on the texture. |
Texture2D.SetPixels ( x : number , y : number , blockWidth : number , blockHeight : number , colors : Color[] , mipLevel : number ) : void |
| Set the pixel colors of a specific area on a texture. |
Texture2D.Apply ( mipLevel : number ) : void |
| Applies the texture data to the texture and updates the modifications made to the texture. |
