Skip to content

Commit 657b3a2

Browse files
committed
Add WaitFrameBeforeRebuild property
1 parent a1d976f commit 657b3a2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Editor/Inspector/FigmaInspector.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class FigmaInspector : Editor
3333
SerializedProperty title;
3434
SerializedProperty filter;
3535
SerializedProperty reorder;
36+
SerializedProperty waitFrameBeforeRebuild;
3637
SerializedProperty fontsDirs;
3738
UIDocument document;
3839
#endregion
@@ -51,6 +52,7 @@ void OnEnable()
5152
title = serializedObject.FindProperty(nameof(title));
5253
filter = serializedObject.FindProperty(nameof(filter));
5354
reorder = serializedObject.FindProperty(nameof(reorder));
55+
waitFrameBeforeRebuild = serializedObject.FindProperty(nameof(waitFrameBeforeRebuild));
5456
fontsDirs = serializedObject.FindProperty(nameof(fontsDirs));
5557
document = ((MonoBehaviour)target).GetComponent<UIDocument>();
5658
}
@@ -139,6 +141,7 @@ void OnFigmaGUI()
139141
EditorGUILayout.PropertyField(reorder, new GUIContent("De-root and Re-order Hierarchy"));
140142
EditorGUILayout.PropertyField(filter, new GUIContent("Filter by Path"));
141143
EditorGUILayout.PropertyField(fontsDirs, new GUIContent("Additional Fonts Directories"));
144+
EditorGUILayout.PropertyField(waitFrameBeforeRebuild, new GUIContent("Wait Frame Before Rebuild"));
142145
EditorGUI.BeginDisabledGroup(true);
143146

144147
if (document && document.visualTreeAsset)

Runtime/Figma.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class Figma : MonoBehaviour
1515
[SerializeField] string title;
1616
[SerializeField] bool filter;
1717
[SerializeField] bool reorder;
18+
[SerializeField] bool waitFrameBeforeRebuild = true;
1819
[SerializeField] string[] fontsDirs;
1920
#endregion
2021

@@ -36,7 +37,7 @@ async void OnEnable()
3637

3738
if (!Application.isPlaying) return;
3839

39-
await new WaitForEndOfFrame();
40+
if (waitFrameBeforeRebuild) await new WaitForEndOfFrame();
4041
VisualElementMetadata.Rebuild(elements);
4142

4243
VisualElement root = document.rootVisualElement.Q(UxmlAttribute.prefix);

0 commit comments

Comments
 (0)