Often when building a project you’ll need to do some sort of repetitive task as part of the work. This can be things like data entry, running a script or other jobs. We can use software to automate some of this work to help save ourselves time and remove the potential slowness of doing things manually. Additionally, this kind of automation can ensure that jobs complete with consistent results with less opportunity for human error. Today we’re going to dive into an implementation of a quick tool to help us convert SVG’s (which Unity can’t natively render) into PNG’s automatically so we can take advantage of SVG based icon packs or designs and the scalability of SVG’s while still being able to view and use the art inside of Unity.
In order to do this we’re going to create a Unity MenuItem
that launches the Inkscape CLI to automatically render images from SVG files in our directory.
The code for this task looks like this:
|
|
You can get a copy of Inkscape here: https://inkscape.org/
The Inkscape Wiki has more information about how you can get started using the Inkscape CLI: https://wiki.inkscape.org/wiki/index.php/Using_the_Command_Line
The icons I’m using are from the Material Design Icons set, you can browse the complete set of icons here: https://materialdesignicons.com/
Join the World of Zero Discord Server: https://discord.gg/hU5Kq2u