Skip to content

Instantly share code, notes, and snippets.

@darktable
Created February 16, 2012 05:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save darktable/1842177 to your computer and use it in GitHub Desktop.
Save darktable/1842177 to your computer and use it in GitHub Desktop.
Unity3D: Editor script to prevent images added to Assets/Platform from being compressed. (Requires Unity Pro?)
using System.IO;
using UnityEditor;
using UnityEngine;
public class IconPostprocessor : AssetPostprocessor {
void OnPreprocessTexture () {
if (assetPath.ToLower().StartsWith(Path.Combine("assets", "platform"))) {
var ti = (TextureImporter) assetImporter;
ti.filterMode = FilterMode.Point;
ti.mipmapEnabled = false;
ti.textureFormat = TextureImporterFormat.ARGB32;
ti.textureType = TextureImporterType.GUI;
ti.wrapMode = TextureWrapMode.Clamp;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment