- Home /
How can I set the `physicsShape` of a sprite within a spritesheet within an editor script?
The spritesheet
field of the TextureImporter
object has type SpriteMetaData[]
and SpriteMetaData
provides no means to set the physicsShape
.
Worse; any attempt to alter one or more sprites from the TextureImporter
's spritesheet
causes any existing physicsShape
objects to be reset to the default []
for every sprite within the spritesheet (not only the ones edited).
I have about 5,000 sprites I want to automatically generate from a script (I already have their dimensions in a separate yaml), without being able to automate their addition this will take me days and days of repetitive mouse clicking. I'm able to alter the aspects of the TextureImporter
that I want besides the spritesheet
.
Do you know what the data format is for altering physicsShape: []
in the meta file? I tried to use the Sprite Editor to change the shape but it does nothing, so I'll have to resort to manually editing the file. Luckily it's only for 6 sprites which isn't too bad.
Your answer
![](https://koobas.hobune.stream/wayback/20220612191952im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How can I programatically set the SpriteMeshType of sprites? 1 Answer
Texture importer script: How to avoid resetting value when make changes 0 Answers
AssetDatabase.ImportAsset fails on generated textures 1 Answer
how to display a single frame of a sprite animation 1 Answer
Deleted unwanted selections/slices in the sprite editor? 2 Answers