Skip to content

Commit a1d976f

Browse files
Update documentation. Debug missing fonts
1 parent c336d23 commit a1d976f

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

Editor/FigmaParser.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -775,11 +775,7 @@ public void Write(StreamWriter stream)
775775
{
776776
stream.WriteLine($".{Name} {{");
777777

778-
if (Has("--unity-font-missing"))
779-
{
780-
Debug.LogWarning($"Cannot find Font [<color=yellow>{attributes["--unity-font-missing"]}</color>]");
781-
attributes.Remove("--unity-font-missing");
782-
}
778+
if (Has("--unity-font-missing")) attributes.Remove("--unity-font-missing");
783779

784780
foreach (KeyValuePair<string, string> keyValue in attributes) stream.WriteLine($" {keyValue.Key}: {keyValue.Value};");
785781

@@ -1464,7 +1460,10 @@ void AddUnityFont()
14641460

14651461
bool valid;
14661462
if (!TryGetFontWithExtension($"{style.fontFamily}-{weightPostfix}{italicPostfix}", out string resource, out string url) && !TryGetFontWithExtension(style.fontPostScriptName, out resource, out url))
1463+
{
14671464
unityFontMissing = $"url('{url}')";
1465+
Debug.LogWarning($"Cannot find Font [<color=yellow>{style.fontFamily}-{weightPostfix}{italicPostfix}</color>]");
1466+
}
14681467

14691468
unityFont = resource;
14701469
(valid, url) = getAssetPath($"{style.fontFamily}-{weightPostfix}{italicPostfix}", "asset");

Readme.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,24 @@ These components serve a dual purpose:
7979
| **Filter by Path** | When activated, this feature limits the download to only those UI frames that have associated scripts attached to the prefab, otherwise, all UI elements within the Figma document will be downloaded. |
8080
| **Additional Fonts Directories** | Provides the capability to specify paths to any fonts that are incorporated within the UI, ensuring seamless visual consistency. |
8181

82+
## Folders Layout
83+
This is how the final setup should look:
84+
```
85+
<UI folder>
86+
├── UI.uxml
87+
├── UI.uss
88+
├── UI.asset
89+
├── remaps_UI.json
90+
├── Elements
91+
│ └── CustomElement.uxml
92+
├── Images
93+
│ ├── AmazingImage.svg
94+
│ └── PerfectImage.png
95+
└── Fonts
96+
└── Inter-Regular.ttf
97+
```
98+
Please note that you need to place your **custom fonts** in a **'Fonts' folder**. If you try to import a Figma document that includes a font which does not exist in the 'Fonts' folder, you will see a message in the console indicating which font is missing. You can also add an additional fonts directory using the appropriate property in the Figma object.
99+
82100
## Figma class
83101
During the update process the Figma class retrieves data based on the Uxml and Query attributes of the Element scripts. It then utilizes this data while producing UXML asset.
84102
> [!WARNING]
@@ -271,4 +289,4 @@ element.Replace(newElement);
271289
- Various CodeGenerators
272290
- Search by name/class/path
273291
- Dragging items for scroll-view
274-
- Generation of the various states of Elements with states
292+
- Generation of the various states of Elements with states- Generation of the various states of Elements with states- Generation of the various states of Elements with states

0 commit comments

Comments
 (0)