@@ -11,7 +11,7 @@ namespace a3geek.PhysicsLayers.Editors
11
11
12
12
public partial class LayersManagerInspector
13
13
{
14
- private List < bool > collInfosFolders = new List < bool > ( ) ;
14
+ // private List<bool> collInfosFolders = new List<bool>();
15
15
16
16
17
17
private void DrawPhysicsLayers ( Dictionary < int , string > layers )
@@ -60,13 +60,14 @@ private void DrawCollInfos(PhysicsLayerInfos layerInfos)
60
60
{
61
61
EditorGUI . indentLevel += 1 ;
62
62
63
- this . collInfosFolders . SetCount ( layerInfos . LayerCount , index => true ) ;
63
+ this . collInfosFolders . SetCount ( layerInfos . LayerCount , index => new CollInfosFolders ( ) ) ;
64
64
65
65
var i = 0 ;
66
66
foreach ( var physicsLayer in layerInfos . GetEnumerable ( ) . OrderBy ( layer => layer . LayerID ) )
67
67
{
68
- this . collInfosFolders [ i ] = EditorGUILayout . Foldout ( this . collInfosFolders [ i ] , "Collision : " + physicsLayer . LayerName , true ) ;
69
- if ( this . collInfosFolders [ i ] == false )
68
+ var folder = this . collInfosFolders [ i ] ;
69
+ folder . collision = EditorGUILayout . Foldout ( folder . collision , "Collision : " + physicsLayer . LayerName , true ) ;
70
+ if ( this . collInfosFolders [ i ] . collision == false )
70
71
{
71
72
i ++ ;
72
73
continue ;
@@ -78,27 +79,41 @@ private void DrawCollInfos(PhysicsLayerInfos layerInfos)
78
79
using ( var vert = new EditorGUILayout . VerticalScope ( ) )
79
80
{
80
81
var keys = collInfos . Keys . OrderBy ( info => info ) ;
81
- var unityKeys = keys . Where ( key => key < LayersManager . UnityLayerCount ) ;
82
82
var physicsKeys = keys . Where ( key => key >= LayersManager . UnityLayerCount ) ;
83
-
84
- EditorGUILayout . LabelField ( " Layers") ;
85
- foreach ( var key in unityKeys )
83
+
84
+ folder . unityLayer = EditorGUILayout . Foldout ( folder . unityLayer , "Unity Layers", true ) ;
85
+ if ( folder . unityLayer == true )
86
86
{
87
- collInfos [ key ] = this . DrawCollInfo ( key , collInfos [ key ] ) ;
87
+ EditorGUI . indentLevel += 1 ;
88
+
89
+ var unityKeys = keys . Where ( key => key < LayersManager . UnityLayerCount ) ;
90
+ foreach ( var key in unityKeys )
91
+ {
92
+ collInfos [ key ] = this . DrawCollInfo ( key , collInfos [ key ] ) ;
93
+ }
94
+
95
+ EditorGUI . indentLevel -= 1 ;
88
96
}
89
97
90
98
EditorGUILayout . Space ( ) ;
91
- EditorGUILayout . LabelField ( "Physics Layers" ) ;
92
- foreach ( var key in physicsKeys )
99
+ folder . physicsLayer = EditorGUILayout . Foldout ( folder . physicsLayer , "Physics Layers" , true ) ;
100
+ if ( folder . physicsLayer == true )
93
101
{
94
- if ( key < physicsLayer . LayerID )
102
+ EditorGUI . indentLevel += 1 ;
103
+
104
+ foreach ( var key in physicsKeys )
95
105
{
96
- collInfos [ key ] = layerInfos [ key ] [ physicsLayer . LayerID ] . Collision ;
97
- }
98
- else
99
- {
100
- collInfos [ key ] = this . DrawCollInfo ( key , collInfos [ key ] ) ;
106
+ if ( key < physicsLayer . LayerID )
107
+ {
108
+ collInfos [ key ] = layerInfos [ key ] [ physicsLayer . LayerID ] . Collision ;
109
+ }
110
+ else
111
+ {
112
+ collInfos [ key ] = this . DrawCollInfo ( key , collInfos [ key ] ) ;
113
+ }
101
114
}
115
+
116
+ EditorGUI . indentLevel -= 1 ;
102
117
}
103
118
}
104
119
0 commit comments