Created
April 11, 2016 10:22
-
-
Save tm8r/46838f6e98aaef9c9dc54d907ff03a02 to your computer and use it in GitHub Desktop.
TextureImageImporter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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