FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
MLAPI/MLAPI-Editor/NetworkingManagerEditor.cs at master · Dropgunner/MLAPI · GitHub
Dropgunner
/
MLAPI
Public
forked from
Unity-Technologies/com.unity.netcode.gameobjects
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
MLAPI
/
MLAPI-Editor
/
NetworkingManagerEditor.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
401 lines (325 loc) · 18.7 KB
Breadcrumbs
MLAPI
/
MLAPI-Editor
/
NetworkingManagerEditor.cs
Copy path
File metadata and controls
401 lines (325 loc) · 18.7 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
using
System
;
using
System
.
Collections
.
Generic
;
using
System
.
Reflection
;
using
UnityEditor
;
using
UnityEngine
;
using
UnityEditorInternal
;
using
MLAPI
;
using
MLAPI
.
Transports
;
using
UnityEditor
.
Callbacks
;
[
CustomEditor
(
typeof
(
NetworkingManager
)
,
true
)
]
[
CanEditMultipleObjects
]
public
class
NetworkingManagerEditor
:
Editor
{
// Properties
private
SerializedProperty
dontDestroyOnLoadProperty
;
private
SerializedProperty
runInBackgroundProperty
;
private
SerializedProperty
logLevelProperty
;
// NetworkConfig
private
SerializedProperty
networkConfigProperty
;
// NetworkConfig fields
private
SerializedProperty
protocolVersionProperty
;
private
SerializedProperty
allowRuntimeSceneChanges
;
private
SerializedProperty
networkTransportProperty
;
private
SerializedProperty
receiveTickrateProperty
;
private
SerializedProperty
maxReceiveEventsPerTickRateProperty
;
private
SerializedProperty
eventTickrateProperty
;
private
SerializedProperty
maxObjectUpdatesPerTickProperty
;
private
SerializedProperty
clientConnectionBufferTimeoutProperty
;
private
SerializedProperty
connectionApprovalProperty
;
private
SerializedProperty
secondsHistoryProperty
;
private
SerializedProperty
enableTimeResyncProperty
;
private
SerializedProperty
timeResyncIntervalProperty
;
private
SerializedProperty
enableNetworkedVarProperty
;
private
SerializedProperty
ensureNetworkedVarLengthSafetyProperty
;
private
SerializedProperty
createPlayerPrefabProperty
;
private
SerializedProperty
forceSamePrefabsProperty
;
private
SerializedProperty
usePrefabSyncProperty
;
private
SerializedProperty
recycleNetworkIdsProperty
;
private
SerializedProperty
networkIdRecycleDelayProperty
;
private
SerializedProperty
rpcHashSizeProperty
;
private
SerializedProperty
loadSceneTimeOutProperty
;
private
SerializedProperty
enableEncryptionProperty
;
private
SerializedProperty
signKeyExchangeProperty
;
private
SerializedProperty
serverBase64PfxCertificateProperty
;
private
ReorderableList
networkPrefabsList
;
private
ReorderableList
registeredScenesList
;
private
NetworkingManager
networkingManager
;
private
bool
initialized
;
private
readonly
List
<
Type
>
transportTypes
=
new
List
<
Type
>
(
)
;
private
string
[
]
transportNames
=
new
string
[
]
{
"Select transport..."
}
;
private
void
ReloadTransports
(
)
{
transportTypes
.
Clear
(
)
;
Assembly
[
]
assemblies
=
AppDomain
.
CurrentDomain
.
GetAssemblies
(
)
;
foreach
(
Assembly
assembly
in
assemblies
)
{
Type
[
]
types
=
assembly
.
GetTypes
(
)
;
foreach
(
Type
type
in
types
)
{
if
(
type
.
IsSubclassOf
(
typeof
(
Transport
)
)
)
{
transportTypes
.
Add
(
type
)
;
}
}
}
transportNames
=
new
string
[
transportTypes
.
Count
+
1
]
;
transportNames
[
0
]
=
"Select transport..."
;
for
(
int
i
=
0
;
i
<
transportTypes
.
Count
;
i
++
)
{
transportNames
[
i
+
1
]
=
transportTypes
[
i
]
.
Name
;
}
}
private
void
Init
(
)
{
if
(
initialized
)
return
;
initialized
=
true
;
networkingManager
=
(
NetworkingManager
)
target
;
// Base properties
dontDestroyOnLoadProperty
=
serializedObject
.
FindProperty
(
"DontDestroy"
)
;
runInBackgroundProperty
=
serializedObject
.
FindProperty
(
"RunInBackground"
)
;
logLevelProperty
=
serializedObject
.
FindProperty
(
"LogLevel"
)
;
networkConfigProperty
=
serializedObject
.
FindProperty
(
"NetworkConfig"
)
;
// NetworkConfig properties
protocolVersionProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"ProtocolVersion"
)
;
allowRuntimeSceneChanges
=
networkConfigProperty
.
FindPropertyRelative
(
"AllowRuntimeSceneChanges"
)
;
networkTransportProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"NetworkTransport"
)
;
receiveTickrateProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"ReceiveTickrate"
)
;
maxReceiveEventsPerTickRateProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"MaxReceiveEventsPerTickRate"
)
;
eventTickrateProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"EventTickrate"
)
;
maxObjectUpdatesPerTickProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"MaxObjectUpdatesPerTick"
)
;
clientConnectionBufferTimeoutProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"ClientConnectionBufferTimeout"
)
;
connectionApprovalProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"ConnectionApproval"
)
;
secondsHistoryProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"SecondsHistory"
)
;
enableTimeResyncProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"EnableTimeResync"
)
;
timeResyncIntervalProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"TimeResyncInterval"
)
;
enableNetworkedVarProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"EnableNetworkedVar"
)
;
ensureNetworkedVarLengthSafetyProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"EnsureNetworkedVarLengthSafety"
)
;
createPlayerPrefabProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"CreatePlayerPrefab"
)
;
forceSamePrefabsProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"ForceSamePrefabs"
)
;
usePrefabSyncProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"UsePrefabSync"
)
;
recycleNetworkIdsProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"RecycleNetworkIds"
)
;
networkIdRecycleDelayProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"NetworkIdRecycleDelay"
)
;
rpcHashSizeProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"RpcHashSize"
)
;
loadSceneTimeOutProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"LoadSceneTimeOut"
)
;
enableEncryptionProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"EnableEncryption"
)
;
signKeyExchangeProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"SignKeyExchange"
)
;
serverBase64PfxCertificateProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"ServerBase64PfxCertificate"
)
;
ReloadTransports
(
)
;
}
private
void
CheckNullProperties
(
)
{
// Base properties
dontDestroyOnLoadProperty
=
serializedObject
.
FindProperty
(
"DontDestroy"
)
;
runInBackgroundProperty
=
serializedObject
.
FindProperty
(
"RunInBackground"
)
;
logLevelProperty
=
serializedObject
.
FindProperty
(
"LogLevel"
)
;
networkConfigProperty
=
serializedObject
.
FindProperty
(
"NetworkConfig"
)
;
// NetworkConfig properties
protocolVersionProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"ProtocolVersion"
)
;
allowRuntimeSceneChanges
=
networkConfigProperty
.
FindPropertyRelative
(
"AllowRuntimeSceneChanges"
)
;
networkTransportProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"NetworkTransport"
)
;
receiveTickrateProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"ReceiveTickrate"
)
;
maxReceiveEventsPerTickRateProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"MaxReceiveEventsPerTickRate"
)
;
eventTickrateProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"EventTickrate"
)
;
maxObjectUpdatesPerTickProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"MaxObjectUpdatesPerTick"
)
;
clientConnectionBufferTimeoutProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"ClientConnectionBufferTimeout"
)
;
connectionApprovalProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"ConnectionApproval"
)
;
secondsHistoryProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"SecondsHistory"
)
;
enableTimeResyncProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"EnableTimeResync"
)
;
timeResyncIntervalProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"TimeResyncInterval"
)
;
enableNetworkedVarProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"EnableNetworkedVar"
)
;
ensureNetworkedVarLengthSafetyProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"EnsureNetworkedVarLengthSafety"
)
;
createPlayerPrefabProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"CreatePlayerPrefab"
)
;
forceSamePrefabsProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"ForceSamePrefabs"
)
;
usePrefabSyncProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"UsePrefabSync"
)
;
recycleNetworkIdsProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"RecycleNetworkIds"
)
;
networkIdRecycleDelayProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"NetworkIdRecycleDelay"
)
;
rpcHashSizeProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"RpcHashSize"
)
;
loadSceneTimeOutProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"LoadSceneTimeOut"
)
;
enableEncryptionProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"EnableEncryption"
)
;
signKeyExchangeProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"SignKeyExchange"
)
;
serverBase64PfxCertificateProperty
=
networkConfigProperty
.
FindPropertyRelative
(
"ServerBase64PfxCertificate"
)
;
}
private
void
OnEnable
(
)
{
networkPrefabsList
=
new
ReorderableList
(
serializedObject
,
serializedObject
.
FindProperty
(
"NetworkConfig"
)
.
FindPropertyRelative
(
"NetworkedPrefabs"
)
,
true
,
true
,
true
,
true
)
;
networkPrefabsList
.
drawElementCallback
=
(
Rect
rect
,
int
index
,
bool
isActive
,
bool
isFocused
)
=>
{
SerializedProperty
element
=
networkPrefabsList
.
serializedProperty
.
GetArrayElementAtIndex
(
index
)
;
int
firstLabelWidth
=
50
;
int
secondLabelWidth
=
140
;
float
secondFieldWidth
=
10
;
int
reduceFirstWidth
=
45
;
EditorGUI
.
LabelField
(
new
Rect
(
rect
.
x
,
rect
.
y
,
firstLabelWidth
,
EditorGUIUtility
.
singleLineHeight
)
,
"Prefab"
)
;
EditorGUI
.
PropertyField
(
new
Rect
(
rect
.
x
+
firstLabelWidth
,
rect
.
y
,
rect
.
width
-
firstLabelWidth
-
secondLabelWidth
-
secondFieldWidth
-
reduceFirstWidth
,
EditorGUIUtility
.
singleLineHeight
)
,
element
.
FindPropertyRelative
(
"Prefab"
)
,
GUIContent
.
none
)
;
EditorGUI
.
LabelField
(
new
Rect
(
rect
.
width
-
secondLabelWidth
-
secondFieldWidth
,
rect
.
y
,
secondLabelWidth
,
EditorGUIUtility
.
singleLineHeight
)
,
"Default Player Prefab"
)
;
int
playerPrefabIndex
=
-
1
;
for
(
int
i
=
0
;
i
<
networkingManager
.
NetworkConfig
.
NetworkedPrefabs
.
Count
;
i
++
)
{
if
(
networkingManager
.
NetworkConfig
.
NetworkedPrefabs
[
i
]
.
PlayerPrefab
)
{
playerPrefabIndex
=
i
;
break
;
}
}
using
(
new
EditorGUI
.
DisabledScope
(
playerPrefabIndex
!=
-
1
&&
playerPrefabIndex
!=
index
)
)
{
EditorGUI
.
PropertyField
(
new
Rect
(
rect
.
width
-
secondFieldWidth
,
rect
.
y
,
secondFieldWidth
,
EditorGUIUtility
.
singleLineHeight
)
,
element
.
FindPropertyRelative
(
"PlayerPrefab"
)
,
GUIContent
.
none
)
;
}
}
;
networkPrefabsList
.
drawHeaderCallback
=
(
Rect
rect
)
=>
{
EditorGUI
.
LabelField
(
rect
,
"NetworkedPrefabs"
)
;
}
;
registeredScenesList
=
new
ReorderableList
(
serializedObject
,
serializedObject
.
FindProperty
(
"NetworkConfig"
)
.
FindPropertyRelative
(
"RegisteredScenes"
)
,
true
,
true
,
true
,
true
)
;
registeredScenesList
.
drawElementCallback
=
(
Rect
rect
,
int
index
,
bool
isActive
,
bool
isFocused
)
=>
{
SerializedProperty
element
=
registeredScenesList
.
serializedProperty
.
GetArrayElementAtIndex
(
index
)
;
int
firstLabelWidth
=
50
;
int
padding
=
20
;
EditorGUI
.
LabelField
(
new
Rect
(
rect
.
x
,
rect
.
y
,
firstLabelWidth
,
EditorGUIUtility
.
singleLineHeight
)
,
"Name"
)
;
EditorGUI
.
PropertyField
(
new
Rect
(
rect
.
x
+
firstLabelWidth
,
rect
.
y
,
rect
.
width
-
firstLabelWidth
-
padding
,
EditorGUIUtility
.
singleLineHeight
)
,
element
,
GUIContent
.
none
)
;
}
;
registeredScenesList
.
drawHeaderCallback
=
(
Rect
rect
)
=>
{
EditorGUI
.
LabelField
(
rect
,
"Registered Scene Names"
)
;
}
;
}
public
override
void
OnInspectorGUI
(
)
{
Init
(
)
;
CheckNullProperties
(
)
;
{
SerializedProperty
iterator
=
serializedObject
.
GetIterator
(
)
;
for
(
bool
enterChildren
=
true
;
iterator
.
NextVisible
(
enterChildren
)
;
enterChildren
=
false
)
{
using
(
new
EditorGUI
.
DisabledScope
(
"m_Script"
==
iterator
.
propertyPath
)
)
{
EditorGUILayout
.
PropertyField
(
iterator
,
false
)
;
}
}
}
if
(
!
networkingManager
.
IsServer
&&
!
networkingManager
.
IsClient
)
{
serializedObject
.
Update
(
)
;
EditorGUILayout
.
PropertyField
(
dontDestroyOnLoadProperty
)
;
EditorGUILayout
.
PropertyField
(
runInBackgroundProperty
)
;
EditorGUILayout
.
PropertyField
(
logLevelProperty
)
;
EditorGUILayout
.
Space
(
)
;
networkPrefabsList
.
DoLayoutList
(
)
;
registeredScenesList
.
DoLayoutList
(
)
;
EditorGUILayout
.
Space
(
)
;
EditorGUILayout
.
LabelField
(
"General"
,
EditorStyles
.
boldLabel
)
;
EditorGUILayout
.
PropertyField
(
protocolVersionProperty
)
;
EditorGUILayout
.
PropertyField
(
networkTransportProperty
)
;
if
(
networkTransportProperty
.
objectReferenceValue
==
null
)
{
EditorGUILayout
.
HelpBox
(
"You have no transport selected. A transport is required for the MLAPI to work. Which one do you want?"
,
MessageType
.
Warning
)
;
int
selection
=
EditorGUILayout
.
Popup
(
0
,
transportNames
)
;
if
(
selection
>
0
)
{
ReloadTransports
(
)
;
Component
transport
=
networkingManager
.
gameObject
.
GetComponent
(
transportTypes
[
selection
-
1
]
)
;
if
(
transport
==
null
)
{
transport
=
networkingManager
.
gameObject
.
AddComponent
(
transportTypes
[
selection
-
1
]
)
;
}
networkTransportProperty
.
objectReferenceValue
=
transport
;
Repaint
(
)
;
}
}
EditorGUILayout
.
PropertyField
(
enableTimeResyncProperty
)
;
using
(
new
EditorGUI
.
DisabledScope
(
!
networkingManager
.
NetworkConfig
.
EnableTimeResync
)
)
{
EditorGUILayout
.
PropertyField
(
timeResyncIntervalProperty
)
;
}
EditorGUILayout
.
LabelField
(
"Performance"
,
EditorStyles
.
boldLabel
)
;
EditorGUILayout
.
PropertyField
(
receiveTickrateProperty
)
;
EditorGUILayout
.
PropertyField
(
maxReceiveEventsPerTickRateProperty
)
;
EditorGUILayout
.
PropertyField
(
eventTickrateProperty
)
;
EditorGUILayout
.
PropertyField
(
enableNetworkedVarProperty
)
;
using
(
new
EditorGUI
.
DisabledScope
(
!
networkingManager
.
NetworkConfig
.
EnableNetworkedVar
)
)
{
EditorGUILayout
.
PropertyField
(
maxObjectUpdatesPerTickProperty
)
;
EditorGUILayout
.
PropertyField
(
ensureNetworkedVarLengthSafetyProperty
)
;
}
EditorGUILayout
.
LabelField
(
"Connection"
,
EditorStyles
.
boldLabel
)
;
EditorGUILayout
.
PropertyField
(
connectionApprovalProperty
)
;
using
(
new
EditorGUI
.
DisabledScope
(
!
networkingManager
.
NetworkConfig
.
ConnectionApproval
)
)
{
EditorGUILayout
.
PropertyField
(
clientConnectionBufferTimeoutProperty
)
;
}
EditorGUILayout
.
LabelField
(
"Lag Compensation"
,
EditorStyles
.
boldLabel
)
;
EditorGUILayout
.
PropertyField
(
secondsHistoryProperty
)
;
EditorGUILayout
.
LabelField
(
"Spawning"
,
EditorStyles
.
boldLabel
)
;
EditorGUILayout
.
PropertyField
(
createPlayerPrefabProperty
)
;
EditorGUILayout
.
PropertyField
(
forceSamePrefabsProperty
)
;
EditorGUILayout
.
PropertyField
(
usePrefabSyncProperty
)
;
EditorGUILayout
.
PropertyField
(
recycleNetworkIdsProperty
)
;
using
(
new
EditorGUI
.
DisabledScope
(
!
networkingManager
.
NetworkConfig
.
RecycleNetworkIds
)
)
{
EditorGUILayout
.
PropertyField
(
networkIdRecycleDelayProperty
)
;
}
EditorGUILayout
.
LabelField
(
"Bandwidth"
,
EditorStyles
.
boldLabel
)
;
EditorGUILayout
.
PropertyField
(
rpcHashSizeProperty
)
;
EditorGUILayout
.
LabelField
(
"Scene Management"
,
EditorStyles
.
boldLabel
)
;
EditorGUILayout
.
PropertyField
(
loadSceneTimeOutProperty
)
;
EditorGUILayout
.
PropertyField
(
allowRuntimeSceneChanges
)
;
EditorGUILayout
.
LabelField
(
"Cryptography"
,
EditorStyles
.
boldLabel
)
;
EditorGUILayout
.
PropertyField
(
enableEncryptionProperty
)
;
using
(
new
EditorGUI
.
DisabledScope
(
!
networkingManager
.
NetworkConfig
.
EnableEncryption
)
)
{
EditorGUILayout
.
PropertyField
(
signKeyExchangeProperty
)
;
EditorGUILayout
.
PropertyField
(
serverBase64PfxCertificateProperty
)
;
}
serializedObject
.
ApplyModifiedProperties
(
)
;
// Start buttons below
{
string
buttonDisabledReasonSuffix
=
""
;
if
(
!
EditorApplication
.
isPlaying
)
{
buttonDisabledReasonSuffix
=
". This can only be done in play mode"
;
GUI
.
enabled
=
false
;
}
if
(
GUILayout
.
Button
(
new
GUIContent
(
"Start Host"
,
"Starts a host instance"
+
buttonDisabledReasonSuffix
)
)
)
{
networkingManager
.
StartHost
(
)
;
}
if
(
GUILayout
.
Button
(
new
GUIContent
(
"Start Server"
,
"Starts a server instance"
+
buttonDisabledReasonSuffix
)
)
)
{
networkingManager
.
StartServer
(
)
;
}
if
(
GUILayout
.
Button
(
new
GUIContent
(
"Start Client"
,
"Starts a client instance"
+
buttonDisabledReasonSuffix
)
)
)
{
networkingManager
.
StartClient
(
)
;
}
if
(
!
EditorApplication
.
isPlaying
)
{
GUI
.
enabled
=
true
;
}
}
}
else
{
string
instanceType
=
""
;
if
(
networkingManager
.
IsHost
)
instanceType
=
"Host"
;
else
if
(
networkingManager
.
IsServer
)
instanceType
=
"Server"
;
else
if
(
networkingManager
.
IsClient
)
instanceType
=
"Client"
;
EditorGUILayout
.
HelpBox
(
"You cannot edit the NetworkConfig when a "
+
instanceType
+
" is running."
,
MessageType
.
Info
)
;
if
(
GUILayout
.
Button
(
new
GUIContent
(
"Stop "
+
instanceType
,
"Stops the "
+
instanceType
+
" instance."
)
)
)
{
if
(
networkingManager
.
IsHost
)
networkingManager
.
StopHost
(
)
;
else
if
(
networkingManager
.
IsServer
)
networkingManager
.
StopServer
(
)
;
else
if
(
networkingManager
.
IsClient
)
networkingManager
.
StopClient
(
)
;
}
}
}
}
Back
|
FazBrowse Home
|
New Git URL