Editor Script - How to set border for a sprite asset

Hi there,

I’m looking for a editor script that let me change border (9 slice scaling) of a sprite asset. Unforutnatlly SpriteAsset doesnt seem to expose these settings.

Please advise
Thanks

To change import settings, you need to look at importers. The border can be changed with TextureImporter.spriteBorder.

Use AssetImporter.GetAtPath to get the importer (cast it to TextureImporter) and call AssetImporter.SaveAndReimport after changing the border.

1 Like

Thanks