OnPostprocessTexture TextureImporter.spritePivot doesn't seem to work.


I am trying to set all sprites that are imported into my project as having a pivot in the bottom left corner of the sprite. This is trivial to do on the inspector and is a simple drop down ‘Pivot’ which has a selection dropdown of pivot points i.e. bottom left and top right.

In the OnPostprocessTexture funciton in a custom AssetPostprocessor, I am setting TextureImporter.spritePivot to Vector2.zero, assuming this to be bottom left but regardless all sprites still import with their pivot point set to center.

Am I doing something wrong?


What I’ve asked for is done like this:

TextureImporterSettings texSettings = new TextureImporterSettings();
 texSettings.spriteAlignment = (int)SpriteAlignment.Custom;

Thanks again Unity for the trash API!