-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVisualElementExtensions.cs
More file actions
32 lines (29 loc) · 915 Bytes
/
Copy pathVisualElementExtensions.cs
File metadata and controls
32 lines (29 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
namespace GOJ.Extensions
{
public static class VisualElementExtensions
{
public static void Hide(this VisualElement element, bool affectLayout = true)
{
if (affectLayout)
element.style.display = DisplayStyle.None;
else
element.style.visibility = Visibility.Hidden;
}
public static void Show(this VisualElement element)
{
element.style.display = DisplayStyle.Flex;
element.style.visibility = Visibility.Visible;
}
public static void SetVisibility(this VisualElement element, bool visible, bool affectLayout = true)
{
if (visible)
Show(element);
else
Hide(element, affectLayout);
}
}
}