@@ -356,13 +356,13 @@ private object Init(bool server)
356
356
MessageManager . messageTypes . Add ( "MLAPI_SPAWN_POOL_OBJECT" , 6 ) ;
357
357
MessageManager . messageTypes . Add ( "MLAPI_DESTROY_POOL_OBJECT" , 7 ) ;
358
358
MessageManager . messageTypes . Add ( "MLAPI_CHANGE_OWNER" , 8 ) ;
359
- MessageManager . messageTypes . Add ( "MLAPI_SYNC_VAR_UPDATE" , 9 ) ;
359
+ // MessageManager.messageTypes.Add("MLAPI_SYNC_VAR_UPDATE", 9); //NOT IN USE
360
360
MessageManager . messageTypes . Add ( "MLAPI_ADD_OBJECTS" , 10 ) ;
361
361
MessageManager . messageTypes . Add ( "MLAPI_TIME_SYNC" , 11 ) ;
362
362
MessageManager . messageTypes . Add ( "MLAPI_COMMAND" , 12 ) ;
363
363
MessageManager . messageTypes . Add ( "MLAPI_RPC" , 13 ) ;
364
364
MessageManager . messageTypes . Add ( "MLAPI_TARGET" , 14 ) ;
365
- MessageManager . messageTypes . Add ( "MLAPI_SET_VISIBILITY" , 15 ) ;
365
+ // MessageManager.messageTypes.Add("MLAPI_SET_VISIBILITY", 15); //NOT IN USE
366
366
MessageManager . messageTypes . Add ( "MLAPI_NETWORKED_VAR_DELTA" , 16 ) ;
367
367
MessageManager . messageTypes . Add ( "MLAPI_NETWORKED_VAR_UPDATE" , 17 ) ;
368
368
@@ -604,7 +604,7 @@ public void StartHost(Vector3? pos = null, Quaternion? rot = null, int prefabId
604
604
if ( NetworkConfig . HandleObjectSpawning )
605
605
{
606
606
prefabId = prefabId == - 1 ? NetworkConfig . NetworkPrefabIds [ NetworkConfig . PlayerPrefabName ] : prefabId ;
607
- SpawnManager . CreateSpawnedObject ( prefabId , 0 , hostClientId , true , pos . GetValueOrDefault ( ) , rot . GetValueOrDefault ( ) , null , false , false , false ) ;
607
+ SpawnManager . CreateSpawnedObject ( prefabId , 0 , hostClientId , true , pos . GetValueOrDefault ( ) , rot . GetValueOrDefault ( ) , null , false , false ) ;
608
608
}
609
609
610
610
SpawnSceneObjects ( ) ;
@@ -718,7 +718,7 @@ private void Update()
718
718
if ( NetworkConfig . ConnectionApproval )
719
719
writer . WriteByteArray ( NetworkConfig . ConnectionData ) ;
720
720
721
- InternalMessageHandler . Send ( clientId , "MLAPI_CONNECTION_REQUEST" , "MLAPI_INTERNAL" , writer , null , null , null , true ) ;
721
+ InternalMessageHandler . Send ( clientId , "MLAPI_CONNECTION_REQUEST" , "MLAPI_INTERNAL" , writer , null , null , true ) ;
722
722
}
723
723
}
724
724
NetworkProfiler . EndEvent ( ) ;
@@ -756,7 +756,6 @@ private void Update()
756
756
NetworkProfiler . StartTick ( TickType . Event ) ;
757
757
eventOvershootCounter += ( ( NetworkTime - lastEventTickTime ) - ( 1f / NetworkConfig . EventTickrate ) ) ;
758
758
LagCompensationManager . AddFrames ( ) ;
759
- NetworkedObject . InvokeSyncvarUpdate ( ) ;
760
759
lastEventTickTime = NetworkTime ;
761
760
NetworkProfiler . EndTick ( ) ;
762
761
}
@@ -986,9 +985,7 @@ private void HandleIncomingData(uint clientId, byte[] data, int channelId, uint
986
985
if ( isClient )
987
986
InternalMessageHandler . HandleChangeOwner ( clientId , messageReader , channelId ) ;
988
987
break ;
989
- case 9 : //Syncvar
990
- if ( isClient )
991
- InternalMessageHandler . HandleSyncVarUpdate ( clientId , messageReader , channelId ) ;
988
+ case 9 : //UNUSED
992
989
break ;
993
990
case 10 :
994
991
if ( isClient ) //MLAPI_ADD_OBJECTS (plural)
@@ -1010,9 +1007,7 @@ private void HandleIncomingData(uint clientId, byte[] data, int channelId, uint
1010
1007
if ( isClient )
1011
1008
InternalMessageHandler . HandleTargetRpc ( clientId , messageReader , channelId ) ;
1012
1009
break ;
1013
- case 15 :
1014
- if ( isClient )
1015
- InternalMessageHandler . HandleSetVisibility ( clientId , messageReader , channelId ) ;
1010
+ case 15 : //UNUSED
1016
1011
break ;
1017
1012
case 16 :
1018
1013
// Handled on both client and server
@@ -1047,9 +1042,6 @@ internal void DisconnectClient(uint clientId)
1047
1042
diffieHellmanPublicKeys . Remove ( clientId ) ;
1048
1043
#endif
1049
1044
1050
- foreach ( KeyValuePair < uint , NetworkedObject > pair in SpawnManager . SpawnedObjects )
1051
- pair . Value . observers . Remove ( clientId ) ;
1052
-
1053
1045
NetworkConfig . NetworkTransport . DisconnectClient ( clientId ) ;
1054
1046
}
1055
1047
@@ -1075,9 +1067,6 @@ internal void OnClientDisconnectFromServer(uint clientId)
1075
1067
1076
1068
if ( isServer )
1077
1069
{
1078
- foreach ( KeyValuePair < uint , NetworkedObject > pair in SpawnManager . SpawnedObjects )
1079
- pair . Value . observers . Remove ( clientId ) ;
1080
-
1081
1070
using ( BitWriter writer = BitWriter . Get ( ) )
1082
1071
{
1083
1072
writer . WriteUInt ( clientId ) ;
@@ -1145,7 +1134,7 @@ internal void HandleApproval(uint clientId, int prefabId, bool approved, Vector3
1145
1134
if ( NetworkConfig . HandleObjectSpawning )
1146
1135
{
1147
1136
prefabId = prefabId == - 1 ? NetworkConfig . NetworkPrefabIds [ NetworkConfig . PlayerPrefabName ] : prefabId ;
1148
- netObject = SpawnManager . CreateSpawnedObject ( prefabId , 0 , clientId , true , position , rotation , null , false , false , false ) ;
1137
+ netObject = SpawnManager . CreateSpawnedObject ( prefabId , 0 , clientId , true , position , rotation , null , false , false ) ;
1149
1138
ConnectedClients [ clientId ] . PlayerObject = netObject ;
1150
1139
}
1151
1140
@@ -1177,25 +1166,19 @@ internal void HandleApproval(uint clientId, int prefabId, bool approved, Vector3
1177
1166
if ( item . Key == clientId )
1178
1167
continue ;
1179
1168
writer . WriteUInt ( item . Key ) ; //ClientId
1180
-
1181
- if ( netObject != null )
1182
- netObject . RebuildObservers ( item . Key ) ;
1183
1169
}
1184
1170
if ( NetworkConfig . HandleObjectSpawning )
1185
1171
{
1186
1172
writer . WriteInt ( amountOfObjectsToSend ) ;
1187
1173
1188
1174
foreach ( KeyValuePair < uint , NetworkedObject > pair in SpawnManager . SpawnedObjects )
1189
1175
{
1190
- pair . Value . RebuildObservers ( clientId ) ; //Rebuilds observers for the new client
1191
-
1192
1176
writer . WriteBool ( pair . Value . isPlayerObject ) ;
1193
1177
writer . WriteUInt ( pair . Value . NetworkId ) ;
1194
1178
writer . WriteUInt ( pair . Value . OwnerClientId ) ;
1195
1179
writer . WriteInt ( NetworkConfig . NetworkPrefabIds [ pair . Value . NetworkedPrefabName ] ) ;
1196
1180
writer . WriteBool ( pair . Value . gameObject . activeInHierarchy ) ;
1197
1181
writer . WriteBool ( pair . Value . sceneObject == null ? true : pair . Value . sceneObject . Value ) ;
1198
- writer . WriteBool ( pair . Value . observers . Contains ( clientId ) ) ;
1199
1182
1200
1183
writer . WriteFloat ( pair . Value . transform . position . x ) ;
1201
1184
writer . WriteFloat ( pair . Value . transform . position . y ) ;
@@ -1205,12 +1188,10 @@ internal void HandleApproval(uint clientId, int prefabId, bool approved, Vector3
1205
1188
writer . WriteFloat ( pair . Value . transform . rotation . eulerAngles . y ) ;
1206
1189
writer . WriteFloat ( pair . Value . transform . rotation . eulerAngles . z ) ;
1207
1190
1208
- if ( pair . Value . observers . Contains ( clientId ) )
1209
- pair . Value . WriteFormattedSyncedVarData ( writer ) ;
1210
1191
pair . Value . WriteNetworkedVarData ( writer , clientId ) ;
1211
1192
}
1212
1193
}
1213
- InternalMessageHandler . Send ( clientId , "MLAPI_CONNECTION_APPROVED" , "MLAPI_INTERNAL" , writer , null , null , null , true ) ;
1194
+ InternalMessageHandler . Send ( clientId , "MLAPI_CONNECTION_APPROVED" , "MLAPI_INTERNAL" , writer , null , null , true ) ;
1214
1195
1215
1196
if ( OnClientConnectedCallback != null )
1216
1197
OnClientConnectedCallback . Invoke ( clientId ) ;
@@ -1232,7 +1213,6 @@ internal void HandleApproval(uint clientId, int prefabId, bool approved, Vector3
1232
1213
writer . WriteUInt ( clientId ) ;
1233
1214
writer . WriteInt ( prefabId ) ;
1234
1215
writer . WriteBool ( false ) ;
1235
- writer . WriteBool ( ConnectedClients [ clientId ] . PlayerObject . GetComponent < NetworkedObject > ( ) . observers . Contains ( clientPair . Key ) ) ;
1236
1216
1237
1217
writer . WriteFloat ( ConnectedClients [ clientId ] . PlayerObject . transform . position . x ) ;
1238
1218
writer . WriteFloat ( ConnectedClients [ clientId ] . PlayerObject . transform . position . y ) ;
@@ -1244,8 +1224,6 @@ internal void HandleApproval(uint clientId, int prefabId, bool approved, Vector3
1244
1224
1245
1225
writer . WriteBool ( false ) ; //No payload data
1246
1226
1247
- if ( ConnectedClients [ clientId ] . PlayerObject . GetComponent < NetworkedObject > ( ) . observers . Contains ( clientPair . Key ) )
1248
- ConnectedClients [ clientId ] . PlayerObject . GetComponent < NetworkedObject > ( ) . WriteFormattedSyncedVarData ( writer ) ;
1249
1227
ConnectedClients [ clientId ] . PlayerObject . GetComponent < NetworkedObject > ( ) . WriteNetworkedVarData ( writer , clientPair . Key ) ;
1250
1228
}
1251
1229
else
0 commit comments