@@ -966,6 +966,9 @@ internal void NetworkedVarUpdate()
966
966
{
967
967
using ( BitWriter writer = BitWriter . Get ( ) )
968
968
{
969
+ writer . WriteUInt ( networkId ) ;
970
+ writer . WriteUShort ( networkedObject . GetOrderIndex ( this ) ) ;
971
+
969
972
uint clientId = NetworkingManager . singleton . ConnectedClientsList [ i ] . ClientId ;
970
973
for ( int j = 0 ; j < networkedVarFields . Count ; j ++ )
971
974
{
@@ -992,38 +995,24 @@ internal void NetworkedVarUpdate()
992
995
993
996
internal void HandleNetworkedVarDeltas ( BitReader reader )
994
997
{
995
- ushort index = reader . ReadUShort ( ) ;
996
- if ( index >= networkedVarFields . Count )
998
+ for ( int i = 0 ; i < networkedVarFields . Count ; i ++ )
997
999
{
998
- if ( LogHelper . CurrentLogLevel <= LogLevel . Normal ) LogHelper . LogWarning ( "NetworkedVar index out of range" ) ;
999
- return ;
1000
- }
1000
+ if ( ! reader . ReadBool ( ) )
1001
+ continue ;
1001
1002
1002
- networkedVarFields [ index ] . SetDeltaFromReader ( reader ) ;
1003
+ networkedVarFields [ i ] . SetDeltaFromReader ( reader ) ;
1004
+ }
1003
1005
}
1004
1006
1005
1007
internal void HandleNetworkedVarUpdate ( BitReader reader )
1006
1008
{
1007
- ushort index = reader . ReadUShort ( ) ;
1008
- if ( index >= networkedVarFields . Count )
1009
+ for ( int i = 0 ; i < networkedVarFields . Count ; i ++ )
1009
1010
{
1010
- if ( LogHelper . CurrentLogLevel <= LogLevel . Normal ) LogHelper . LogWarning ( "NetworkedVar index out of range" ) ;
1011
- return ;
1012
- }
1013
-
1014
- networkedVarFields [ index ] . SetFieldFromReader ( reader ) ;
1015
- }
1011
+ if ( ! reader . ReadBool ( ) )
1012
+ continue ;
1016
1013
1017
- internal ushort GetNetworkedVarIndex ( INetworkedVar networkedVar )
1018
- {
1019
- int index = networkedVarFields . IndexOf ( networkedVar ) ;
1020
- if ( index == - 1 )
1021
- {
1022
- if ( LogHelper . CurrentLogLevel <= LogLevel . Error ) LogHelper . LogWarning ( "Unable to find NetworkedVar instance" ) ;
1023
- return 0 ;
1014
+ networkedVarFields [ i ] . SetFieldFromReader ( reader ) ;
1024
1015
}
1025
-
1026
- return ( ushort ) index ;
1027
1016
}
1028
1017
1029
1018
#endregion
0 commit comments