function OnPostprocessTexture (texture : Texture2D) : void
Description
Add this function in a subclass to get a notification when a texture has completed importing just before the texture is saved to disk.
class InvertColor
extends AssetPostprocessor {
function OnPostprocessTexture (texture :
Texture2D) {
var lowerCaseAssetPath = assetPath.ToLower();
if (lowerCaseAssetPath.IndexOf (
"/invert color/") == -1)
return;
for (
var m :
int = 0; m < texture.mipmapCount; m++) {
var c :
Color[] = texture.GetPixels(m);
for (
var i :
int = 0 ;i < c.Length; i++) {
c[i].r = 1 - c[i].r;
c[i].g = 1 - c[i].g;
c[i].b = 1 - c[i].b;
}
texture.SetPixels(c, m);
}
}
}