Repository navigation
Releases
Releases · matbcontrol/affinity-ui-exporter
v1.3.0
Added
- Render only the selected layers again (
onlySelected): the sprites of the selected layers are rendered, the others come from the last export into the same folder. New layers and layers of another size are rendered anyway. On a 3840×2160 screen with three cards, one changed card took 16 s instead of 35 to 57 s.
Changed
_preview.pngis not exported by default any more: it took about a fifth of the time, and Unity does not use it. Turn on Export a preview image (exportPreview) to compare. Documents that saved this setting in the dialog keep it.- The colours of texts are analysed about three times as fast, with the same results. The rest of an export is Affinity rendering the sprites;
docs/ARCHITECTURE.mdlists where the time goes.
Updating from 1.2.0
- Unity: change
#v1.2.0to#v1.3.0in the git URL of the package, or update it in the Package Manager if it came from OpenUPM. Nothing changes in the prefabs: this version is about the exporter. - Affinity: delete "Unity UI Exporter" in the Scripts Library (right click, Delete Script...) and import the new file. Turn on Export a preview image in the dialog if you compare Unity with Affinity; documents that saved the setting keep it.
Install
- Affinity: import
export-to-unity.afscriptbelow into the Scripts Library, as in the quick start. - Unity: Package Manager, Install package from git URL:
https://github.com/matbcontrol/affinity-ui-exporter.git?path=/unity/com.matbcontrol.affinity-ui-exporter#v1.3.0
or from OpenUPM:openupm add com.matbcontrol.affinity-ui-exporter
v1.2.0
Added
- Rotated text stays live and keeps its angle, also in rotated groups. Its shadow falls in the same direction as in the design.
- Text frames keep their vertical alignment: top, middle or bottom. Their text always started at the top.
- Highlights behind parts of a text (
AffinityTextHighlight), and the stroke of letters from the character settings. - Text that is justified with its last line in the middle, on the right, or over the whole width.
- Fill layers, for example one that darkens the game behind a window. They were left out.
Changed
- Skewed and mirrored text becomes a sprite instead of straight live text. Tag the layer
[live]to keep it as text. - An export no longer fills the undo history of the document. It left up to dozens of steps, and now at most one, plus one for new ids and one for changed settings.
Fixed
- Texts whose shadows only differ in their direction no longer share one material.
- Outlines of live text are as wide as in the design. They were up to twice as wide.
- A screen whose layers are all in one group adapts to other proportions, also when a wide bar lies at the top.
- Texts in square brackets, like
[ 35 ], keep their name, and are no tags. - A text with a gradient that becomes a sprite loses its TextMesh Pro component.
- The first line of text frames lies where Affinity draws it with every font. It was about a pixel too high at 32 px with Roboto.
- Lines of different font sizes, like a title with text below it, have the same distances as in Affinity.
- The spaces before and after a paragraph are not added any more; Affinity uses the larger one by default. Line breaks inside a paragraph (Shift+Enter) add no space.
Updating from 1.1.0
- Unity: change
#v1.1.0to#v1.2.0in the git URL of the package. Unity then imports all.affuifiles again. Variants keep their overrides. - Outlines of live text become thinner, and lines of text move by up to a few pixels, because both follow the design now. If you corrected them by hand in a variant, look at these texts.
- Affinity: delete "Unity UI Exporter" in the Scripts Library (right click, Delete Script...) and import the new file. Export your screens again for everything under "Added", and for screens in one group that should adapt to other proportions.
Install
- Affinity: import
export-to-unity.afscriptbelow into the Scripts Library, as in the quick start. - Unity: Package Manager, Install package from git URL:
https://github.com/matbcontrol/affinity-ui-exporter.git?path=/unity/com.matbcontrol.affinity-ui-exporter#v1.2.0
v1.1.0
Added
[prefab]: repeated groups become instances of a nested prefab in theComponentsfolder, on all screens of a document. Instances only store what differs in the design, and hidden layers in them are inactive objects.[button]: groups and layers become Unity buttons.[hover],[pressed],[selected]and[disabled]layers, also hidden ones, are their states.[fill:left],[fill:right],[fill:top],[fill:bottom]and[fill:radial]: bars and timers with one value from 0 to 1 (AffinityFill).
Updating from 1.0.0
- Unity: change
#v1.0.0to#v1.1.0in the git URL of the package. Unity then imports all.affuifiles again. Variants keep their overrides. The prefab files change once, becauseAffinityNodehas new fields. - Affinity: delete "Unity UI Exporter" in the Scripts Library (right click, Delete Script...) and import the new file, because Affinity would add a second script with the same name.
- The new tags need both the new script and the new package.
Install
- Affinity: import
export-to-unity.afscriptbelow into the Scripts Library, as in the quick start. - Unity: Package Manager, Install package from git URL:
https://github.com/matbcontrol/affinity-ui-exporter.git?path=/unity/com.matbcontrol.affinity-ui-exporter#v1.1.0
v1.0.0
First public version.
Exporter (Affinity)
- One screen per artboard, or the whole spread. A dialog asks for the folder, the name, the artboards and the sprite scale (0.5x to 4x) and remembers them in the document.
- Text stays live: fonts, sizes, colours, tracking, leading, alignment, paragraph spacing, shadow, glow, outline, linear gradients and colour overlays. Text with other effects is baked.
- Everything else is rendered by Affinity itself, with its effects and blend modes. Layers with Add, Screen or Multiply, and outer glows with Screen or Add, stay separate and blend with what is below them in the game.
- Anchors are inferred from the layout. The painted scene behind the UI is recognised and left out.
- Layer name tags for what cannot be guessed:
[anchor:...],[stretch],[9slice:...],[split],[bake],[live],[mock]. - A report in the file says what was decided about the layers, and which fonts are missing.
Importer (Unity)
.affuifiles become uGUI prefabs withImageandTextMeshProUGUI. New exports update the prefab by the ids of the layers, and Prefab Variants keep their overrides.- The sprites of a screen share a compressed atlas. Uniform middles are cut out and sliced, smooth pictures are stored smaller.
- Backgrounds cover screens of other proportions (
AffinityCover). - A Font Map connects the fonts of the design with TextMesh Pro font assets, and a menu command creates them.
AffinityGammaUIFeaturefor URP blends the UI in sRGB in Linear projects, as Affinity does.- "Demo Screens" sample.
Install
- Affinity: import
export-to-unity.afscriptbelow into the Scripts Library, as in the quick start. - Unity: Package Manager, Install package from git URL:
https://github.com/matbcontrol/affinity-ui-exporter.git?path=/unity/com.matbcontrol.affinity-ui-exporter#v1.0.0