Skip to content

Instantly share code, notes, and snippets.

@tm8r
Created April 11, 2016 10:22
Show Gist options
  • Save tm8r/46838f6e98aaef9c9dc54d907ff03a02 to your computer and use it in GitHub Desktop.
Save tm8r/46838f6e98aaef9c9dc54d907ff03a02 to your computer and use it in GitHub Desktop.
TextureImageImporter
using UnityEngine;
using UnityEditor;
using System.IO;
public class TextureImageImporter : AssetPostprocessor
{
static readonly string[] targetExtensions = { ".tga" };
void OnPreprocessTexture ()
{
bool isValidExtension = false;
foreach (var extension in targetExtensions) {
if (Path.GetExtension (assetPath).ToLower ().Equals (extension)) {
isValidExtension = true;
break;
}
}
if (!isValidExtension) {
return;
}
var importer = assetImporter as TextureImporter;
importer.textureType = TextureImporterType.Advanced;
importer.npotScale = TextureImporterNPOTScale.None;
importer.alphaIsTransparency = true;
importer.mipmapEnabled = false;
importer.lightmap = false;
importer.normalmap = false;
importer.linearTexture = false;
importer.wrapMode = TextureWrapMode.Repeat;
importer.generateCubemap = TextureImporterGenerateCubemap.None;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment