@@ -91,17 +91,20 @@ private void OnEnable()
91
91
92
92
93
93
int firstLabelWidth = 50 ;
94
- int secondLabelWidth = 90 ;
95
- float secondFieldWidth = 10 ;
96
- int reduceFirstWidth = 45 ;
94
+ int secondLabelWidth = networkingManager . NetworkConfig . AllowPassthroughMessages ? 90 : 0 ;
95
+ float secondFieldWidth = networkingManager . NetworkConfig . AllowPassthroughMessages ? 10 : 0 ;
96
+ int reduceFirstWidth = networkingManager . NetworkConfig . AllowPassthroughMessages ? 45 : 20 ;
97
97
98
98
EditorGUI . LabelField ( new Rect ( rect . x , rect . y , firstLabelWidth , EditorGUIUtility . singleLineHeight ) , "Name" ) ;
99
99
EditorGUI . PropertyField ( new Rect ( rect . x + firstLabelWidth , rect . y , rect . width - firstLabelWidth - secondLabelWidth - secondFieldWidth - reduceFirstWidth ,
100
100
EditorGUIUtility . singleLineHeight ) , element . FindPropertyRelative ( "Name" ) , GUIContent . none ) ;
101
101
102
- EditorGUI . LabelField ( new Rect ( rect . width - secondLabelWidth - secondFieldWidth , rect . y , secondLabelWidth , EditorGUIUtility . singleLineHeight ) , "Passthrough" ) ;
103
- EditorGUI . PropertyField ( new Rect ( rect . width - secondFieldWidth , rect . y , secondFieldWidth ,
104
- EditorGUIUtility . singleLineHeight ) , element . FindPropertyRelative ( "Passthrough" ) , GUIContent . none ) ;
102
+ if ( networkingManager . NetworkConfig . AllowPassthroughMessages )
103
+ {
104
+ EditorGUI . LabelField ( new Rect ( rect . width - secondLabelWidth - secondFieldWidth , rect . y , secondLabelWidth , EditorGUIUtility . singleLineHeight ) , "Passthrough" ) ;
105
+ EditorGUI . PropertyField ( new Rect ( rect . width - secondFieldWidth , rect . y , secondFieldWidth ,
106
+ EditorGUIUtility . singleLineHeight ) , element . FindPropertyRelative ( "Passthrough" ) , GUIContent . none ) ;
107
+ }
105
108
} ;
106
109
107
110
messageTypesList . drawHeaderCallback = ( Rect rect ) => {
@@ -118,10 +121,10 @@ private void OnEnable()
118
121
int firstLabelWidth = 50 ;
119
122
int secondLabelWidth = 40 ;
120
123
int secondFieldWidth = 150 ;
121
- int thirdLabelWidth = 70 ;
122
- int thirdFieldWidth = 10 ;
124
+ int thirdLabelWidth = networkingManager . NetworkConfig . EnableEncryption ? 70 : 0 ;
125
+ int thirdFieldWidth = networkingManager . NetworkConfig . EnableEncryption ? 10 : 0 ;
123
126
int reduceFirstWidth = 45 ;
124
- int reduceSecondWidth = 10 ;
127
+ int reduceSecondWidth = networkingManager . NetworkConfig . EnableEncryption ? 10 : 0 ;
125
128
126
129
EditorGUI . LabelField ( new Rect ( rect . x , rect . y , firstLabelWidth , EditorGUIUtility . singleLineHeight ) , "Name" ) ;
127
130
EditorGUI . PropertyField ( new Rect ( rect . x + firstLabelWidth , rect . y , rect . width - firstLabelWidth - secondLabelWidth - secondFieldWidth - thirdFieldWidth - thirdLabelWidth - reduceFirstWidth ,
@@ -132,14 +135,35 @@ private void OnEnable()
132
135
EditorGUI . PropertyField ( new Rect ( rect . width - secondFieldWidth - thirdLabelWidth - thirdFieldWidth , rect . y , secondFieldWidth - reduceSecondWidth ,
133
136
EditorGUIUtility . singleLineHeight ) , element . FindPropertyRelative ( "Type" ) , GUIContent . none ) ;
134
137
135
- EditorGUI . LabelField ( new Rect ( rect . width - thirdFieldWidth - thirdLabelWidth , rect . y , thirdLabelWidth , EditorGUIUtility . singleLineHeight ) , "Encrypted" ) ;
136
- EditorGUI . PropertyField ( new Rect ( rect . width - thirdFieldWidth , rect . y , secondFieldWidth ,
137
- EditorGUIUtility . singleLineHeight ) , element . FindPropertyRelative ( "Encrypted" ) , GUIContent . none ) ;
138
+ if ( networkingManager . NetworkConfig . EnableEncryption )
139
+ {
140
+ EditorGUI . LabelField ( new Rect ( rect . width - thirdFieldWidth - thirdLabelWidth , rect . y , thirdLabelWidth , EditorGUIUtility . singleLineHeight ) , "Encrypted" ) ;
141
+ EditorGUI . PropertyField ( new Rect ( rect . width - thirdFieldWidth , rect . y , secondFieldWidth ,
142
+ EditorGUIUtility . singleLineHeight ) , element . FindPropertyRelative ( "Encrypted" ) , GUIContent . none ) ;
143
+ }
138
144
} ;
139
145
140
146
channelsList . drawHeaderCallback = ( Rect rect ) => {
141
147
EditorGUI . LabelField ( rect , "Channels (Auto Sorted)" ) ;
142
148
} ;
149
+
150
+
151
+ registeredScenesList = new ReorderableList ( serializedObject , serializedObject . FindProperty ( "NetworkConfig" ) . FindPropertyRelative ( "RegisteredScenes" ) , true , true , true , true ) ;
152
+ registeredScenesList . drawElementCallback = ( Rect rect , int index , bool isActive , bool isFocused ) =>
153
+ {
154
+ SerializedProperty element = registeredScenesList . serializedProperty . GetArrayElementAtIndex ( index ) ;
155
+ int firstLabelWidth = 50 ;
156
+ int padding = 20 ;
157
+
158
+ EditorGUI . LabelField ( new Rect ( rect . x , rect . y , firstLabelWidth , EditorGUIUtility . singleLineHeight ) , "Name" ) ;
159
+ EditorGUI . PropertyField ( new Rect ( rect . x + firstLabelWidth , rect . y , rect . width - firstLabelWidth - padding ,
160
+ EditorGUIUtility . singleLineHeight ) , element , GUIContent . none ) ;
161
+
162
+ } ;
163
+
164
+ registeredScenesList . drawHeaderCallback = ( Rect rect ) => {
165
+ EditorGUI . LabelField ( rect , "Registered Scene Names (Auto Sorted)" ) ;
166
+ } ;
143
167
}
144
168
145
169
public override void OnInspectorGUI ( )
@@ -153,13 +177,21 @@ public override void OnInspectorGUI()
153
177
EditorGUILayout . PropertyField ( RunInBackgroundProperty ) ;
154
178
EditorGUILayout . PropertyField ( LogLevelProperty ) ;
155
179
156
- EditorGUILayout . Space ( ) ;
157
- networkPrefabsList . DoLayoutList ( ) ;
180
+ if ( networkingManager . NetworkConfig . HandleObjectSpawning )
181
+ {
182
+ EditorGUILayout . Space ( ) ;
183
+ networkPrefabsList . DoLayoutList ( ) ;
184
+ }
158
185
EditorGUILayout . Space ( ) ;
159
186
messageTypesList . DoLayoutList ( ) ;
160
187
EditorGUILayout . Space ( ) ;
161
188
channelsList . DoLayoutList ( ) ;
162
189
EditorGUILayout . Space ( ) ;
190
+ if ( networkingManager . NetworkConfig . EnableSceneSwitching )
191
+ {
192
+ registeredScenesList . DoLayoutList ( ) ;
193
+ EditorGUILayout . Space ( ) ;
194
+ }
163
195
164
196
serializedObject . ApplyModifiedProperties ( ) ;
165
197
base . OnInspectorGUI ( ) ;
0 commit comments