- Home /
Question by
Deadcow_ · Feb 24, 2016 at 05:54 PM ·
spritesassetsimporting assetstextureimporter
TextureImporter settings not applied
I've wrote AssetPostprocessor script to process imported sprites. Whole script is pretty plain
public class ImpotrProcessor : AssetPostprocessor
{
private void OnPostprocessSprites(Texture2D texture, Sprite[] sprites)
{
if (assetPath.ToUpper().Contains("UI") || assetPath.Contains("Standard Assets")) return;
var importer = assetImporter as TextureImporter;
if (importer == null) return;
if (importer.textureType != TextureImporterType.Sprite) return;
importer.filterMode = FilterMode.Point;
importer.spritePixelsPerUnit = 16;
importer.textureFormat = TextureImporterFormat.AutomaticTruecolor;
importer.mipmapEnabled = false;
Debug.Log("Import settings applied on " + assetPath);
}
}
Although sprite settings looks fine in inspector, them not applied on sprite. I need to change any setting in inspector (otherwise "Apply button is not active) and hit "Apply".
Comment
Best Answer
Answer by Deadcow_ · Mar 12, 2016 at 05:21 PM
Oh, I was to stupid to wrestle with this problem for a few days and didn't notice that I was using Postprocess method instead of OnPostprocessTexture().
Your answer

Follow this Question
Related Questions
How load and manage multiple images(sprites) in Unity? 0 Answers
Implementing AForge into unity 0 Answers
Change compression type to every sprite 1 Answer