OnPostprocessTexture TextureImporter.spritePivot doesn't seem to work.

Hi,

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?

Cheers

What I’ve asked for is done like this:

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

Thanks again Unity for the trash API!