Skip to content

Commit ec76c07

Browse files
committed
Added unity editor checks
1 parent 23866ee commit ec76c07

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Assets/Kekser/ComponentSystem/ComponentUI/UIDocumentRenderer.cs

+6
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ public abstract class UIDocumentRenderer<TComponent> : MonoBehaviour where TComp
1414

1515
private UIRenderer _renderer;
1616

17+
// TODO: check if uiDocument is null
18+
1719
private void CreateRenderer()
1820
{
21+
#if UNITY_EDITOR
1922
_uiDocument.runInEditMode = true;
23+
#endif
2024
_uiDocument.rootVisualElement.styleSheets.Clear();
2125
foreach (var style in _styles)
2226
_uiDocument.rootVisualElement.styleSheets.Add(style);
@@ -37,8 +41,10 @@ private void Start()
3741

3842
private void Update()
3943
{
44+
#if UNITY_EDITOR
4045
if (_renderer == null)
4146
CreateRenderer();
47+
#endif
4248
_renderer.Update();
4349
}
4450

0 commit comments

Comments
 (0)