@@ -677,7 +677,9 @@ public void Shutdown()
677677 }
678678 networkTickSystem = null ;
679679
680+ #if ! UNITY_2020_2_OR_LATER
680681 NetworkProfiler . Stop ( ) ;
682+ #endif
681683 IsListening = false ;
682684 IsServer = false ;
683685 IsClient = false ;
@@ -731,7 +733,9 @@ private void OnNetworkEarlyUpdate()
731733#endif
732734 var IsLoopBack = false ;
733735
736+ #if ! UNITY_2020_2_OR_LATER
734737 NetworkProfiler . StartTick ( TickType . Receive ) ;
738+ #endif
735739
736740 //If we are in loopback mode, we don't need to touch the transport
737741 if ( ! IsLoopBack )
@@ -750,7 +754,9 @@ private void OnNetworkEarlyUpdate()
750754
751755 m_LastReceiveTickTime = NetworkTime ;
752756
757+ #if ! UNITY_2020_2_OR_LATER
753758 NetworkProfiler . EndTick ( ) ;
759+ #endif
754760
755761#if DEVELOPMENT_BUILD || UNITY_EDITOR
756762 s_ReceiveTick . End ( ) ;
@@ -769,7 +775,7 @@ private void OnNetworkPreUpdate()
769775#if DEVELOPMENT_BUILD || UNITY_EDITOR
770776 s_EventTick . Begin ( ) ;
771777#endif
772- #if UNITY_EDITOR
778+ #if UNITY_EDITOR && ! UNITY_2020_2_OR_LATER
773779 NetworkProfiler . StartTick ( TickType . Event ) ;
774780#endif
775781
@@ -794,7 +800,7 @@ private void OnNetworkPreUpdate()
794800 {
795801 m_LastEventTickTime = NetworkTime ;
796802 }
797- #if UNITY_EDITOR
803+ #if UNITY_EDITOR && ! UNITY_2020_2_OR_LATER
798804 NetworkProfiler . EndTick ( ) ;
799805#endif
800806
@@ -804,25 +810,25 @@ private void OnNetworkPreUpdate()
804810 }
805811 else if ( IsServer && m_EventOvershootCounter >= ( ( 1f / NetworkConfig . EventTickrate ) ) )
806812 {
807- #if UNITY_EDITOR
813+ #if UNITY_EDITOR && ! UNITY_2020_2_OR_LATER
808814 NetworkProfiler . StartTick ( TickType . Event ) ;
809815#endif
810816 //We run this one to compensate for previous update overshoots.
811817 m_EventOvershootCounter -= ( 1f / NetworkConfig . EventTickrate ) ;
812818 LagCompensationManager . AddFrames ( ) ;
813- #if UNITY_EDITOR
819+ #if UNITY_EDITOR && ! UNITY_2020_2_OR_LATER
814820 NetworkProfiler . EndTick ( ) ;
815821#endif
816822 }
817823
818824 if ( IsServer && NetworkConfig . EnableTimeResync && NetworkTime - m_LastTimeSyncTime >= NetworkConfig . TimeResyncInterval )
819825 {
820- #if UNITY_EDITOR
826+ #if UNITY_EDITOR && ! UNITY_2020_2_OR_LATER
821827 NetworkProfiler . StartTick ( TickType . Event ) ;
822828#endif
823829 SyncTime ( ) ;
824830 m_LastTimeSyncTime = NetworkTime ;
825- #if UNITY_EDITOR
831+ #if UNITY_EDITOR && ! UNITY_2020_2_OR_LATER
826832 NetworkProfiler . EndTick ( ) ;
827833#endif
828834 }
@@ -903,7 +909,9 @@ private void HandleRawTransportPoll(NetEventType eventType, ulong clientId, Chan
903909#if DEVELOPMENT_BUILD || UNITY_EDITOR
904910 s_TransportConnect . Begin ( ) ;
905911#endif
912+ #if ! UNITY_2020_2_OR_LATER
906913 NetworkProfiler . StartEvent ( TickType . Receive , ( uint ) payload . Count , channel , "TRANSPORT_CONNECT" ) ;
914+ #endif
907915 if ( IsServer )
908916 {
909917 if ( NetworkLog . CurrentLogLevel <= LogLevel . Developer ) NetworkLog . LogInfo ( "Client Connected" ) ;
@@ -922,7 +930,9 @@ private void HandleRawTransportPoll(NetEventType eventType, ulong clientId, Chan
922930 SendConnectionRequest ( ) ;
923931 StartCoroutine ( ApprovalTimeout ( clientId ) ) ;
924932 }
933+ #if ! UNITY_2020_2_OR_LATER
925934 NetworkProfiler . EndEvent ( ) ;
935+ #endif
926936#if DEVELOPMENT_BUILD || UNITY_EDITOR
927937 s_TransportConnect . End ( ) ;
928938#endif
@@ -937,7 +947,9 @@ private void HandleRawTransportPoll(NetEventType eventType, ulong clientId, Chan
937947#if DEVELOPMENT_BUILD || UNITY_EDITOR
938948 s_TransportDisconnect . Begin ( ) ;
939949#endif
950+ #if ! UNITY_2020_2_OR_LATER
940951 NetworkProfiler . StartEvent ( TickType . Receive , 0 , Channel . Internal , "TRANSPORT_DISCONNECT" ) ;
952+ #endif
941953
942954 if ( NetworkLog . CurrentLogLevel <= LogLevel . Developer ) NetworkLog . LogInfo ( "Disconnect Event From " + clientId ) ;
943955
@@ -951,7 +963,10 @@ private void HandleRawTransportPoll(NetEventType eventType, ulong clientId, Chan
951963
952964 if ( OnClientDisconnectCallback != null )
953965 OnClientDisconnectCallback . Invoke ( clientId ) ;
966+
967+ #if ! UNITY_2020_2_OR_LATER
954968 NetworkProfiler . EndEvent ( ) ;
969+ #endif
955970#if DEVELOPMENT_BUILD || UNITY_EDITOR
956971 s_TransportDisconnect . End ( ) ;
957972#endif
@@ -988,7 +1003,10 @@ internal void HandleIncomingData(ulong clientId, Channel channel, ArraySegment<b
9881003 }
9891004
9901005 uint headerByteSize = ( uint ) Arithmetic . VarIntSize ( messageType ) ;
1006+
1007+ #if ! UNITY_2020_2_OR_LATER
9911008 NetworkProfiler . StartEvent ( TickType . Receive , ( uint ) ( data . Count - headerByteSize ) , channel , messageType ) ;
1009+ #endif
9921010
9931011 if ( NetworkLog . CurrentLogLevel <= LogLevel . Developer ) NetworkLog . LogInfo ( "Data Header: messageType=" + messageType ) ;
9941012
@@ -1117,7 +1135,9 @@ internal void HandleIncomingData(ulong clientId, Channel channel, ArraySegment<b
11171135 }
11181136 #endregion
11191137
1138+ #if ! UNITY_2020_2_OR_LATER
11201139 NetworkProfiler . EndEvent ( ) ;
1140+ #endif
11211141 }
11221142#if DEVELOPMENT_BUILD || UNITY_EDITOR
11231143 s_HandleIncomingData . End ( ) ;
0 commit comments