Skip to content

Commit 2e51b9f

Browse files
committed
refactor: add namespace
1 parent 4f3d9e5 commit 2e51b9f

File tree

1 file changed

+35
-31
lines changed

1 file changed

+35
-31
lines changed

Editor/HideInactiveObjects.cs

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,48 @@
44
using UnityEditor;
55
using UnityEngine;
66

7-
public class HideInactiveObjects : EditorWindow
7+
namespace jp.kyre.hideInactiveObjects
88
{
9-
private static bool isHiddenObjects = false;
10-
private static bool enableForWholeHierarchy = true;
11-
private static List<GameObject> targetObjects = new List<GameObject>();
12-
13-
static GameObject[] GetInactiveObjects(GameObject[] allObjects)
9+
public class Main : EditorWindow
1410
{
15-
GameObject[] inactiveObjects = Array.FindAll(allObjects, x => (!x.activeInHierarchy && !x.activeSelf && x.name != "InternalIdentityTransform"));
16-
return inactiveObjects;
17-
}
11+
private static bool isHiddenObjects = false;
12+
private static bool enableForWholeHierarchy = true;
13+
private static List<GameObject> targetObjects = new List<GameObject>();
14+
15+
static GameObject[] GetInactiveObjects(GameObject[] allObjects)
16+
{
17+
GameObject[] inactiveObjects = Array.FindAll(allObjects, x => (!x.activeInHierarchy && !x.activeSelf && x.name != "InternalIdentityTransform"));
18+
return inactiveObjects;
19+
}
1820

19-
static void HideObjects(GameObject[] targets)
20-
{
21-
foreach (var target in targets)
21+
static void HideObjects(GameObject[] targets)
2222
{
23-
target.hideFlags = HideFlags.HideInHierarchy;
23+
foreach (var target in targets)
24+
{
25+
target.hideFlags = HideFlags.HideInHierarchy;
26+
}
2427
}
25-
}
2628

27-
static void DisplayObjects(GameObject[] targets)
28-
{
29-
foreach (var target in targets)
29+
static void DisplayObjects(GameObject[] targets)
3030
{
31-
target.hideFlags = HideFlags.None;
31+
foreach (var target in targets)
32+
{
33+
target.hideFlags = HideFlags.None;
34+
}
3235
}
33-
}
3436

35-
static GameObject[] getChildObjects(List<GameObject> targetObjects)
36-
{
37-
// 長過ぎ
38-
GameObject[] children = targetObjects
39-
.Select(targetObject =>
40-
targetObject.transform.Cast<Transform>()
41-
.Select(x => x.gameObject).ToArray()
42-
)
43-
.SelectMany(x => x).ToArray();
37+
static GameObject[] getChildObjects(List<GameObject> targetObjects)
38+
{
39+
// 長過ぎ
40+
GameObject[] children = targetObjects
41+
.Select(targetObject =>
42+
targetObject.transform.Cast<Transform>()
43+
.Select(x => x.gameObject).ToArray()
44+
)
45+
.SelectMany(x => x).ToArray();
4446

45-
return children;
46-
}
47+
return children;
48+
}
4749

4850
[MenuItem("Tools/Hide Inactive Objects/Enable")]
4951
static void Toggle()
@@ -74,7 +76,7 @@ static bool ValidateToggle()
7476
[MenuItem("Tools/Hide Inactive Objects/Options")]
7577
public static void ShowWindow()
7678
{
77-
GetWindow<HideInactiveObjects>("Hide Inactive Objects");
79+
GetWindow<Main>("Hide Inactive Objects");
7880
}
7981

8082
bool showError = false;
@@ -116,4 +118,6 @@ private void OnGUI()
116118

117119
if (showError) GUILayout.Label("Error: Object を指定するか Hierarchy 全体に設定を有効化してください", new GUIStyle() {normal = new GUIStyleState() { textColor = Color.red }});
118120
}
121+
}
122+
119123
}

0 commit comments

Comments
 (0)