@@ -46,78 +46,78 @@ static GameObject[] getChildObjects(List<GameObject> targetObjects)
4646
4747 return children ;
4848 }
49-
50- [ MenuItem ( "Tools/Hide Inactive Objects/Enable" ) ]
51- static void Toggle ( )
52- {
53- GameObject [ ] allObjects = Resources . FindObjectsOfTypeAll < GameObject > ( ) ;
5449
55- if ( isHiddenObjects )
50+ [ MenuItem ( "Tools/Hide Inactive Objects/Enable" ) ]
51+ static void Toggle ( )
5652 {
57- DisplayObjects ( GetInactiveObjects ( enableForWholeHierarchy ? allObjects : getChildObjects ( targetObjects ) ) ) ;
53+ GameObject [ ] allObjects = Resources . FindObjectsOfTypeAll < GameObject > ( ) ;
54+
55+ if ( isHiddenObjects )
56+ {
57+ DisplayObjects ( GetInactiveObjects ( enableForWholeHierarchy ? allObjects : getChildObjects ( targetObjects ) ) ) ;
58+ }
59+ else
60+ {
61+ HideObjects ( GetInactiveObjects ( enableForWholeHierarchy ? allObjects : getChildObjects ( targetObjects ) ) ) ;
62+ }
63+
64+ isHiddenObjects = ! isHiddenObjects ;
65+
66+ Menu . SetChecked ( "Tools/Hide Inactive Objects/Enable" , isHiddenObjects ) ;
5867 }
59- else
68+
69+ [ MenuItem ( "Tools/Hide Inactive Objects/Enable" , true ) ]
70+ static bool ValidateToggle ( )
6071 {
61- HideObjects ( GetInactiveObjects ( enableForWholeHierarchy ? allObjects : getChildObjects ( targetObjects ) ) ) ;
72+ Menu . SetChecked ( "Tools/Hide Inactive Objects/Enable" , isHiddenObjects ) ;
73+ return true ;
6274 }
63-
64- isHiddenObjects = ! isHiddenObjects ;
6575
66- Menu . SetChecked ( "Tools/Hide Inactive Objects/Enable" , isHiddenObjects ) ;
67- }
68-
69- [ MenuItem ( "Tools/Hide Inactive Objects/Enable" , true ) ]
70- static bool ValidateToggle ( )
71- {
72- Menu . SetChecked ( "Tools/Hide Inactive Objects/Enable" , isHiddenObjects ) ;
73- return true ;
74- }
75-
76- [ MenuItem ( "Tools/Hide Inactive Objects/Options" ) ]
77- public static void ShowWindow ( )
78- {
79- GetWindow < Main > ( "Hide Inactive Objects" ) ;
80- }
76+ [ MenuItem ( "Tools/Hide Inactive Objects/Options" ) ]
77+ public static void ShowWindow ( )
78+ {
79+ GetWindow < Main > ( "Hide Inactive Objects" ) ;
80+ }
8181
82- bool showError = false ;
82+ bool showError = false ;
8383
84- private void OnGUI ( )
85- {
86- enableForWholeHierarchy = EditorGUILayout . Toggle ( "Enable for whole hierarchy" , enableForWholeHierarchy ) ;
84+ private void OnGUI ( )
85+ {
86+ enableForWholeHierarchy = EditorGUILayout . Toggle ( "Enable for whole hierarchy" , enableForWholeHierarchy ) ;
8787
88- targetObjects = targetObjects . Select ( ( obj , i ) =>
89- ( GameObject ) EditorGUILayout . ObjectField ( $ "GameObject { i + 1 } ", obj , typeof ( GameObject ) , true ) ) . ToList ( ) ;
88+ targetObjects = targetObjects . Select ( ( obj , i ) =>
89+ ( GameObject ) EditorGUILayout . ObjectField ( $ "GameObject { i + 1 } ", obj , typeof ( GameObject ) , true ) ) . ToList ( ) ;
9090
91- GUILayout . BeginHorizontal ( ) ;
91+ GUILayout . BeginHorizontal ( ) ;
9292
93- if ( GUILayout . Button ( "+" ) )
94- {
95- targetObjects . Add ( null ) ;
96- }
93+ if ( GUILayout . Button ( "+" ) )
94+ {
95+ targetObjects . Add ( null ) ;
96+ }
9797
98- if ( GUILayout . Button ( "-" ) )
99- {
100- targetObjects . RemoveAt ( targetObjects . Count - 1 ) ;
101- }
98+ if ( GUILayout . Button ( "-" ) )
99+ {
100+ targetObjects . RemoveAt ( targetObjects . Count - 1 ) ;
101+ }
102102
103- GUILayout . EndHorizontal ( ) ;
103+ GUILayout . EndHorizontal ( ) ;
104104
105- GameObject [ ] allObjects = Resources . FindObjectsOfTypeAll < GameObject > ( ) ;
105+ GameObject [ ] allObjects = Resources . FindObjectsOfTypeAll < GameObject > ( ) ;
106106
107- if ( GUILayout . Button ( isHiddenObjects ? "Hide" : "Display" ) )
108- {
109- Debug . Log ( $ "targetObjects.Count: { targetObjects . Count ( ) } ") ;
107+ if ( GUILayout . Button ( isHiddenObjects ? "Hide" : "Display" ) )
108+ {
109+ Debug . Log ( $ "targetObjects.Count: { targetObjects . Count ( ) } ") ;
110110
111- if ( targetObjects . Count ( ) == 0 && ! enableForWholeHierarchy ) showError = true ;
111+ if ( targetObjects . Count ( ) == 0 && ! enableForWholeHierarchy ) showError = true ;
112112
113- else {
114- Toggle ( ) ;
115- showError = false ;
113+ else {
114+ Toggle ( ) ;
115+ showError = false ;
116+ }
116117 }
117- }
118118
119- if ( showError ) GUILayout . Label ( "Error: Object を指定するか Hierarchy 全体に設定を有効化してください" , new GUIStyle ( ) { normal = new GUIStyleState ( ) { textColor = Color . red } } ) ;
120- }
119+ if ( showError ) GUILayout . Label ( "Error: Object を指定するか Hierarchy 全体に設定を有効化してください" , new GUIStyle ( ) { normal = new GUIStyleState ( ) { textColor = Color . red } } ) ;
120+ }
121121 }
122122
123123}
0 commit comments