@@ -356,13 +356,13 @@ private object Init(bool server)
356356 MessageManager . messageTypes . Add ( "MLAPI_SPAWN_POOL_OBJECT" , 6 ) ;
357357 MessageManager . messageTypes . Add ( "MLAPI_DESTROY_POOL_OBJECT" , 7 ) ;
358358 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
360360 MessageManager . messageTypes . Add ( "MLAPI_ADD_OBJECTS" , 10 ) ;
361361 MessageManager . messageTypes . Add ( "MLAPI_TIME_SYNC" , 11 ) ;
362362 MessageManager . messageTypes . Add ( "MLAPI_COMMAND" , 12 ) ;
363363 MessageManager . messageTypes . Add ( "MLAPI_RPC" , 13 ) ;
364364 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
366366 MessageManager . messageTypes . Add ( "MLAPI_NETWORKED_VAR_DELTA" , 16 ) ;
367367 MessageManager . messageTypes . Add ( "MLAPI_NETWORKED_VAR_UPDATE" , 17 ) ;
368368
@@ -604,7 +604,7 @@ public void StartHost(Vector3? pos = null, Quaternion? rot = null, int prefabId
604604 if ( NetworkConfig . HandleObjectSpawning )
605605 {
606606 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 ) ;
608608 }
609609
610610 SpawnSceneObjects ( ) ;
@@ -718,7 +718,7 @@ private void Update()
718718 if ( NetworkConfig . ConnectionApproval )
719719 writer . WriteByteArray ( NetworkConfig . ConnectionData ) ;
720720
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 ) ;
722722 }
723723 }
724724 NetworkProfiler . EndEvent ( ) ;
@@ -756,7 +756,6 @@ private void Update()
756756 NetworkProfiler . StartTick ( TickType . Event ) ;
757757 eventOvershootCounter += ( ( NetworkTime - lastEventTickTime ) - ( 1f / NetworkConfig . EventTickrate ) ) ;
758758 LagCompensationManager . AddFrames ( ) ;
759- NetworkedObject . InvokeSyncvarUpdate ( ) ;
760759 lastEventTickTime = NetworkTime ;
761760 NetworkProfiler . EndTick ( ) ;
762761 }
@@ -986,9 +985,7 @@ private void HandleIncomingData(uint clientId, byte[] data, int channelId, uint
986985 if ( isClient )
987986 InternalMessageHandler . HandleChangeOwner ( clientId , messageReader , channelId ) ;
988987 break ;
989- case 9 : //Syncvar
990- if ( isClient )
991- InternalMessageHandler . HandleSyncVarUpdate ( clientId , messageReader , channelId ) ;
988+ case 9 : //UNUSED
992989 break ;
993990 case 10 :
994991 if ( isClient ) //MLAPI_ADD_OBJECTS (plural)
@@ -1010,9 +1007,7 @@ private void HandleIncomingData(uint clientId, byte[] data, int channelId, uint
10101007 if ( isClient )
10111008 InternalMessageHandler . HandleTargetRpc ( clientId , messageReader , channelId ) ;
10121009 break ;
1013- case 15 :
1014- if ( isClient )
1015- InternalMessageHandler . HandleSetVisibility ( clientId , messageReader , channelId ) ;
1010+ case 15 : //UNUSED
10161011 break ;
10171012 case 16 :
10181013 // Handled on both client and server
@@ -1047,9 +1042,6 @@ internal void DisconnectClient(uint clientId)
10471042 diffieHellmanPublicKeys . Remove ( clientId ) ;
10481043#endif
10491044
1050- foreach ( KeyValuePair < uint , NetworkedObject > pair in SpawnManager . SpawnedObjects )
1051- pair . Value . observers . Remove ( clientId ) ;
1052-
10531045 NetworkConfig . NetworkTransport . DisconnectClient ( clientId ) ;
10541046 }
10551047
@@ -1075,9 +1067,6 @@ internal void OnClientDisconnectFromServer(uint clientId)
10751067
10761068 if ( isServer )
10771069 {
1078- foreach ( KeyValuePair < uint , NetworkedObject > pair in SpawnManager . SpawnedObjects )
1079- pair . Value . observers . Remove ( clientId ) ;
1080-
10811070 using ( BitWriter writer = BitWriter . Get ( ) )
10821071 {
10831072 writer . WriteUInt ( clientId ) ;
@@ -1145,7 +1134,7 @@ internal void HandleApproval(uint clientId, int prefabId, bool approved, Vector3
11451134 if ( NetworkConfig . HandleObjectSpawning )
11461135 {
11471136 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 ) ;
11491138 ConnectedClients [ clientId ] . PlayerObject = netObject ;
11501139 }
11511140
@@ -1177,25 +1166,19 @@ internal void HandleApproval(uint clientId, int prefabId, bool approved, Vector3
11771166 if ( item . Key == clientId )
11781167 continue ;
11791168 writer . WriteUInt ( item . Key ) ; //ClientId
1180-
1181- if ( netObject != null )
1182- netObject . RebuildObservers ( item . Key ) ;
11831169 }
11841170 if ( NetworkConfig . HandleObjectSpawning )
11851171 {
11861172 writer . WriteInt ( amountOfObjectsToSend ) ;
11871173
11881174 foreach ( KeyValuePair < uint , NetworkedObject > pair in SpawnManager . SpawnedObjects )
11891175 {
1190- pair . Value . RebuildObservers ( clientId ) ; //Rebuilds observers for the new client
1191-
11921176 writer . WriteBool ( pair . Value . isPlayerObject ) ;
11931177 writer . WriteUInt ( pair . Value . NetworkId ) ;
11941178 writer . WriteUInt ( pair . Value . OwnerClientId ) ;
11951179 writer . WriteInt ( NetworkConfig . NetworkPrefabIds [ pair . Value . NetworkedPrefabName ] ) ;
11961180 writer . WriteBool ( pair . Value . gameObject . activeInHierarchy ) ;
11971181 writer . WriteBool ( pair . Value . sceneObject == null ? true : pair . Value . sceneObject . Value ) ;
1198- writer . WriteBool ( pair . Value . observers . Contains ( clientId ) ) ;
11991182
12001183 writer . WriteFloat ( pair . Value . transform . position . x ) ;
12011184 writer . WriteFloat ( pair . Value . transform . position . y ) ;
@@ -1205,12 +1188,10 @@ internal void HandleApproval(uint clientId, int prefabId, bool approved, Vector3
12051188 writer . WriteFloat ( pair . Value . transform . rotation . eulerAngles . y ) ;
12061189 writer . WriteFloat ( pair . Value . transform . rotation . eulerAngles . z ) ;
12071190
1208- if ( pair . Value . observers . Contains ( clientId ) )
1209- pair . Value . WriteFormattedSyncedVarData ( writer ) ;
12101191 pair . Value . WriteNetworkedVarData ( writer , clientId ) ;
12111192 }
12121193 }
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 ) ;
12141195
12151196 if ( OnClientConnectedCallback != null )
12161197 OnClientConnectedCallback . Invoke ( clientId ) ;
@@ -1232,7 +1213,6 @@ internal void HandleApproval(uint clientId, int prefabId, bool approved, Vector3
12321213 writer . WriteUInt ( clientId ) ;
12331214 writer . WriteInt ( prefabId ) ;
12341215 writer . WriteBool ( false ) ;
1235- writer . WriteBool ( ConnectedClients [ clientId ] . PlayerObject . GetComponent < NetworkedObject > ( ) . observers . Contains ( clientPair . Key ) ) ;
12361216
12371217 writer . WriteFloat ( ConnectedClients [ clientId ] . PlayerObject . transform . position . x ) ;
12381218 writer . WriteFloat ( ConnectedClients [ clientId ] . PlayerObject . transform . position . y ) ;
@@ -1244,8 +1224,6 @@ internal void HandleApproval(uint clientId, int prefabId, bool approved, Vector3
12441224
12451225 writer . WriteBool ( false ) ; //No payload data
12461226
1247- if ( ConnectedClients [ clientId ] . PlayerObject . GetComponent < NetworkedObject > ( ) . observers . Contains ( clientPair . Key ) )
1248- ConnectedClients [ clientId ] . PlayerObject . GetComponent < NetworkedObject > ( ) . WriteFormattedSyncedVarData ( writer ) ;
12491227 ConnectedClients [ clientId ] . PlayerObject . GetComponent < NetworkedObject > ( ) . WriteNetworkedVarData ( writer , clientPair . Key ) ;
12501228 }
12511229 else
0 commit comments