View Online: Version: Latest written by @sator-imaging on
Follow us on X (formerly Twitter) and YouTube for latest updates!!
Before watching tutorial videos, open SVG Toolkit window by selecting menu in Unity editor.
Tools > SVG Toolkit > Toolkit
Tools > SVG Toolkit > Batcher
[!TIP] 🇯🇵 日本語字幕、中国語・韓国語機械翻訳あり。
🇨🇳 提供日语字幕和中文/韩文机器翻译。
🇰🇷 일본어 자막과 중국어/한국어 기계 번역이 제공됩니다.
🇺🇸 Japanese subtitles and Chinese/Korean machine-translations are available.
Part 1 | Part 2 |
---|---|
![]() |
![]() |
Toolkit | Batcher |
You can install additional preset libraries. See repository description for license and installation instructions.
https://github.com/sator-imaging/StkPreset-Game-Icons
T.B.D.
The Canvas
coordinate system is NOT included in the SVG specification, but SVG Tookit will magically process it, even though it is marked experimental
.
If you encounter problems with the canvas coordinate system, feel free to contact us on our X (formerly Twitter) or official Unity forum.
To set secondary color, enable Two-Tone and set Target option to Has Fill or Opacity
.
[!TIP]
Material Icons Two Tone
collection has gap between shapes. To solve the problem, add thin strokes to fill these gaps.
* Image courtesy of MDN (https://developer.mozilla.org/en-US/docs/Web/SVG)
Batcher collection file stores snapshot of added SVG icon presets.
It means that when source .svg preset is updated, added icon DON'T get changed so that you need to add updated icon to Batcher and remove older one manually, by finding item with Duplicates
filter.
[!TIP] With this behavior, you can copy & paste SVG source code directly from website to add it to Batcher collection on the fly. No need to save it in your local storage. (take care about SVG license)
[!TIP] If you want to export a collection with multiple visual styles, use
{operator}
or{DisplayOperatorName}
token in export path format.
[!TIP] Some icon collections are designed and crisp rendered in 24px or multiplier. To use non-power-of-2 textures efficiently, consider packing generated icons into texture atlas by sprite packer.
[!NOTE] Unity has hard coded limit of maximum number of
Texture2D
objects loded in Unity Editor environment. If you set thumbnail size so small, Batcher shows notification that it has reached to limit.Note that limit affects only display. Collection items are correctly handled inside.
[!TIP] You can ignore or override operator settings by using
style
attribute for root<svg>
tag or descendant SVG elements.
For example, adding style="stroke:none"
will ignore all of stroke settings in operator.
<svg... style="stroke: none">
<!-- preset contents -->
</svg>
In same way, you can add style="fill:red"
to override fill colors in operator settings.
<svg... style="fill: red">
<!-- preset contents -->
</svg>
In SVG Toolkit development, we used this technique to merge multiple collection into one single collection.
As you can see, 2 icons listed at bottom right of window override and ignore fill & stroke colors from operator.
You can see the following reference to understand SVG markup language & CSS styles.
Display...
tokens are replaced with Kebab-Case
, other tokens are replaced with PascalCase
.
my batch collection
My-Batch-Collection
MyBatchCollection
Preset library consists of the following 2 files.
.stkcatalog
JSON file with file extension .stkcatalog
, with the following properties.
string?
stirng?
Icon[]?
string?
preset file path in .zip
archivestring?
comma separated tagsstring?
must be omitted for read-only presets[!TIP] If both license properties are filled, SVG Toolkit shows confirmation dialog in preset browser.
.stkpresets
Generic Zip archive containing SVG preset files. SVG Toolkit will always load content as SVG so that file extension for files in zip archive can be omitted.
[!NOTE] SVG Toolkit expects preset to have no fill, stroke or opacity attributes on SVG elements.
SVG Toolkit will treat the preset as a stroke collection if it has stroke=\"
(leading one white space included) in the root <svg>
tag.
[!NOTE] SVG Toolkit does NOT validate that preset is correctly setted up.
For two-tone preset, add fill
and/or opacity
(recommended) attribute to shapes that you want to assign secondary color.
[!NOTE] Two-Tone Target option has option for
style
attribute but it should not be used. It is designed to use with .svg files exported from Affinity Designer, Adobe Illustrator or other drawing applications.
.stkbatchop
T.B.D.