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

Texture Import Settings problem!

$
0
0
Ahoy, I want to change texture settings, apparently the pivot of the texture on runtime. But this code doesn't seems to work, (no errors just no change in pivot): if (Input.GetKeyDown(KeyCode.Space)) { Debug.Log("Pivot Before : " + mySprite.pivot); path = AssetDatabase.GetAssetPath(texture); TextureImporter texImporter = AssetImporter.GetAtPath(path) as TextureImporter; TextureImporterSettings texSettings = new TextureImporterSettings(); texImporter.ReadTextureSettings(texSettings); texSettings.spriteAlignment = (int)SpriteAlignment.Center; texSettings.spritePivot = new Vector2(0.5f, 0.5f); AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate); //AssetDatabase.WriteImportSettingsIfDirty(path); Debug.Log("Pivot Now : " + mySprite.pivot); } The logs for both pivot now and before results the same, doesn't change anything. I used the following code from this [thread][1]. [1]: http://answers.unity3d.com/questions/770913/setting-sprite-pivot-through-editor-script.html It would be very helpful if someone points me where I am wrong. Thanks.

Viewing all articles
Browse latest Browse all 190

Trending Articles



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