Search Unity

How can i use skinning editor to Auto Gemotry spritesheet by code not grahic?

Discussion in '2D' started by luoweihong, Jun 14, 2022.

  1. luoweihong

    luoweihong

    Joined:
    May 27, 2019
    Posts:
    56
    i want to use skinning editor to reduce the transparent part of spritesheet, by using the auto geometry item, and generate For All visible sprite, but i got much spritesheet in my project, so i wonder how can i do this by code?
     

    Attached Files:

  2. MarekUnity

    MarekUnity

    Unity Technologies

    Joined:
    Jan 6, 2017
    Posts:
    204
    @luoweihong is it a frame-by-frame flip book animation or is a skinned character that needs to handle deformation?

    I don't see any bones in your screenshot so I'm assuming it's frame-by-frame animation. In that case your mesh is automatically generated on import and the mesh type is set to "Tight" by default to minimise overdraw. You could also define your own custom outline in the Custom Outline editor.
     
  3. luoweihong

    luoweihong

    Joined:
    May 27, 2019
    Posts:
    56
    it is a frame by frame aniamtion, what i want is reduce overdraw, i think maybe i can use skinning editor to do this,i dont need to generate bone for the png, I just want the mesh tighter than the auto setting by default setting
     
  4. luoweihong

    luoweihong

    Joined:
    May 27, 2019
    Posts:
    56
    because i have ten thousand pngs, so i wonder how can i do this by code
     
  5. MarekUnity

    MarekUnity

    Unity Technologies

    Joined:
    Jan 6, 2017
    Posts:
    204
    Just to clarify, the mesh you see in the Skinning Editor is used only when you skin your Sprite. By default, your Sprites will use the auto-generated tight mesh. You can preview your Sprite meshes in Scene view if you change the "Draw Mode" to Shaded Wireframe or Wireframe as seen in this screenshot:
    Draw Mode.png

    We currently don't have any official APIs to automate outline generation from code, but if you have means to generate your own outline you could do so using the AssetPostprocessor as described here with the ISpriteOutlineDataProvider.
     
    Last edited: Jun 16, 2022
  6. luoweihong

    luoweihong

    Joined:
    May 27, 2019
    Posts:
    56
    got it...but i think if there have an official apis to generate outline in editor will be great, or maybe overdraw does not a problem with performance?