MrJoy / UnitySVG

SVG renderer for Unity3D.
Other
272 stars 52 forks source link

UnitySVG

Overview

UnitySVG is a library for reading SVG files and producing Texture2D objects from them at runtime. The intent is to allow some of one's art assets to be reduced considerably in terms of the net time needed before the user can begin playing the game.

In order for this to be viable, three things must be true:

On unity versions 2018.1 or later try using SVG importer by unity which provides more functionality; it can be installed into unity project by going into package manager -> Vector Graphics. More details can be found here

Compatibility

A very limited subset of SVG is supported, specifically excluding:

Essentially, only things involved in rendering static images are supported, excluding features related to clarity of the XML, "reuse", or whatnot. The principle workflow I had envisioned for this centered around (semi-)auto-generated conversions from raster to vector format, so some of the more high-level features of SVG were simply not relevant.

Performance

Pretty awful right now. See benchmarks.txt for specifics.

I strongly suggest installing and using SVGO to optimize SVG files before use.

History

The initial version of the code is a modified version of SavageSVG

This fork offer major improvements in memory usage (as much as 500:1 in some extreme cases), though I have yet to appreciably improve either parsing or rendering times on hardware that isn't heavily memory-bound.

License

See LICENSE for more information.

TODO

Please note that it is unlikely I will have time to do much of this, these are merely the things I see as necessary to achieving the goals above. I post this with my minor improvements for the daring to dabble with, and am willing to accept pull requests.

More ambitious ideas include:

Developing UnitySVG

Workstation Setup

OS X

You need Mono. The best way to ensure you get this, plus have paths set up properly is to use HomeBrew.

brew install astyle mono

Make sure you add this to your .profile (or whatever file is appropriate to your shell), and restart your terminal:

export MONO_GAC_PREFIX="/usr/local"