Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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