Quantcast
Channel: Questions in topic: "sprite editor"
Viewing all articles
Browse latest Browse all 190

How do you use code to set spriteAlignment for sub-images of a sprite in Multiple mode?

$
0
0
In a class derived from AssetPostprocessor, I use this code to change some default settings when importing image assets: void OnPreprocessTexture (){ TextureImporter textureImporter = (TextureImporter)assetImporter; //This successfully turns off filtering for my pixel art textureImporter.filterMode = FilterMode.Point; //This sets alignment to top left for regular sprites (Sprite Mode=Single), //but not if Sprite Mode = Multiple. TextureImporterSettings texSettings = new TextureImporterSettings(); textureImporter.ReadTextureSettings(texSettings); texSettings.spriteAlignment = (int)SpriteAlignment.TopLeft; textureImporter.SetTextureSettings(texSettings); } However, this doesn't work for the sub-images when the sprite mode is "Multiple". When I open the sprite editor, each sub-image seems to have its own alignment setting but I can't figure out how to access these with code.

Viewing all articles
Browse latest Browse all 190

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>