@@ -1735,7 +1735,7 @@ internal void SynchronizeNetworkBehaviours<T>(ref BufferSerializer<T> serializer
17351735 {
17361736 var writer = serializer . GetFastBufferWriter ( ) ;
17371737 var positionBeforeSynchronizing = writer . Position ;
1738- writer . WriteValueSafe ( ( ushort ) 0 ) ;
1738+ writer . WriteValueSafe ( 0 ) ;
17391739 var sizeToSkipCalculationPosition = writer . Position ;
17401740
17411741 // Synchronize NetworkVariables
@@ -1766,7 +1766,7 @@ internal void SynchronizeNetworkBehaviours<T>(ref BufferSerializer<T> serializer
17661766 // synchronization.
17671767 writer . Seek ( positionBeforeSynchronizing ) ;
17681768 // We want the size of everything after our size to skip calculation position
1769- var size = ( ushort ) ( currentPosition - sizeToSkipCalculationPosition ) ;
1769+ var size = currentPosition - sizeToSkipCalculationPosition ;
17701770 writer . WriteValueSafe ( size ) ;
17711771 // Write the number of NetworkBehaviours synchronized
17721772 writer . Seek ( networkBehaviourCountPosition ) ;
@@ -1778,7 +1778,7 @@ internal void SynchronizeNetworkBehaviours<T>(ref BufferSerializer<T> serializer
17781778 else
17791779 {
17801780 var reader = serializer . GetFastBufferReader ( ) ;
1781- reader . ReadValueSafe ( out ushort sizeOfSynchronizationData ) ;
1781+ reader . ReadValueSafe ( out int sizeOfSynchronizationData ) ;
17821782 var seekToEndOfSynchData = reader . Position + sizeOfSynchronizationData ;
17831783
17841784 try
@@ -1792,14 +1792,13 @@ internal void SynchronizeNetworkBehaviours<T>(ref BufferSerializer<T> serializer
17921792
17931793 // Read the number of NetworkBehaviours to synchronize
17941794 reader . ReadValueSafe ( out byte numberSynchronized ) ;
1795- var networkBehaviourId = ( ushort ) 0 ;
17961795
17971796 // If a NetworkBehaviour writes synchronization data, it will first
17981797 // write its NetworkBehaviourId so when deserializing the client-side
17991798 // can find the right NetworkBehaviour to deserialize the synchronization data.
18001799 for ( int i = 0 ; i < numberSynchronized ; i ++ )
18011800 {
1802- serializer . SerializeValue ( ref networkBehaviourId ) ;
1801+ reader . ReadValueSafe ( out ushort networkBehaviourId ) ;
18031802 var networkBehaviour = GetNetworkBehaviourAtOrderIndex ( networkBehaviourId ) ;
18041803 networkBehaviour . Synchronize ( ref serializer , targetClientId ) ;
18051804 }
0 commit comments