Skip to content

Commit 297bcf4

Browse files
committed
feat: add error label
1 parent 1f9e8f0 commit 297bcf4

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Editor/HideInactiveObjects.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ public static void ShowWindow()
6565
{
6666
GetWindow<HideInactiveObjects>("Hide Inactive Objects");
6767
}
68+
69+
bool showError = false;
6870

6971
private void OnGUI()
7072
{
@@ -91,12 +93,16 @@ private void OnGUI()
9193

9294
if (GUILayout.Button(isHiddenObjects ? "Hide" : "Display"))
9395
{
94-
ToggleOption();
95-
}
96-
97-
if (targetObjects != null)
98-
{
96+
Debug.Log($"targetObjects.Count: {targetObjects.Count()}");
97+
98+
if (targetObjects.Count() == 0 && !enableForWholeHierarchy) showError = true;
9999

100+
else {
101+
Toggle();
102+
showError = false;
103+
}
100104
}
105+
106+
if (showError) GUILayout.Label("Error: Object を指定するか Hierarchy 全体に設定を有効化してください", new GUIStyle() {normal = new GUIStyleState() { textColor = Color.red }});
101107
}
102108
}

0 commit comments

Comments
 (0)