all-iver / shapes2d

Shapes2D for Unity3D - Make simple art assets quickly in Unity
http://sub-c.org/Shapes2D/documentation/
MIT License
157 stars 28 forks source link

Allow setting bake-to-PNG resolution for UI shapes (currently only works for sprite shapes) #10

Open all-iver opened 4 years ago

all-iver commented 4 years ago

Easy fix is:

in Shapes2D/Scripts/Shapes.cs, change the lines at 1514,1515 from this:

    w = Mathf.Max(1, Mathf.RoundToInt(bounds.size.x / scaleFactor));
    h = Mathf.Max(1, Mathf.RoundToInt(bounds.size.y / scaleFactor));

to:

    w = Mathf.Max(1, Mathf.RoundToInt(bounds.size.x / scaleFactor * pixelsPerUnit / 100));
    h = Mathf.Max(1, Mathf.RoundToInt(bounds.size.y / scaleFactor * pixelsPerUnit / 100));

Then you can use the "Pixels Per Unit" setting in Shapes2D/Preferences, so for instance if you set it to 400 then your 64x64 Shape gets turned into a 256x256 PNG which should look nicer. You can also play around with the mipmap settings for the imported PNG, that might make a difference in how it ends up looking in-game.

Really, it might be nice to be able to set the PNG resolution you want each time you bake to sprite.