@@ -100,6 +100,21 @@ private enum State
100
100
[ Tooltip ( "The maximum size in bytes of the send queue for batching Netcode events" ) ]
101
101
[ SerializeField ] private int m_SendQueueBatchSize = InitialBatchQueueSize ;
102
102
103
+ [ Tooltip ( "A timeout in milliseconds after which a heartbeat is sent if there is no activity." ) ]
104
+ [ SerializeField ] private int m_HeartbeatTimeoutMS = NetworkParameterConstants . HeartbeatTimeoutMS ;
105
+
106
+ [ Tooltip ( "A timeout in milliseconds indicating how long we will wait until we send a new connection attempt." ) ]
107
+ [ SerializeField ] private int m_ConnectTimeoutMS = NetworkParameterConstants . ConnectTimeoutMS ;
108
+
109
+ [ Tooltip ( "The maximum amount of connection attempts we will try before disconnecting." ) ]
110
+ [ SerializeField ] private int m_MaxConnectAttempts = NetworkParameterConstants . MaxConnectAttempts ;
111
+
112
+ [ Tooltip ( "A timeout in milliseconds indicating how long we will wait for a connection event, before we disconnect it. " +
113
+ "(The connection needs to receive data from the connected endpoint within this timeout." +
114
+ "Note that with heartbeats enabled, simply not" +
115
+ "sending any data will not be enough to trigger this timeout (since heartbeats count as connection event)" ) ]
116
+ [ SerializeField ] private int m_DisconnectTimeoutMS = NetworkParameterConstants . DisconnectTimeoutMS ;
117
+
103
118
[ Serializable ]
104
119
public struct ConnectionAddressData
105
120
{
@@ -758,20 +773,23 @@ public override void Shutdown()
758
773
759
774
public void CreateDriver ( UnityTransport transport , out NetworkDriver driver , out NetworkPipeline unreliableSequencedPipeline , out NetworkPipeline reliableSequencedPipeline , out NetworkPipeline reliableSequencedFragmentedPipeline )
760
775
{
761
-
762
- #if UNITY_EDITOR || DEVELOPMENT_BUILD
763
776
var netParams = new NetworkConfigParameter
764
777
{
765
- maxConnectAttempts = NetworkParameterConstants . MaxConnectAttempts ,
766
- connectTimeoutMS = NetworkParameterConstants . ConnectTimeoutMS ,
767
- disconnectTimeoutMS = NetworkParameterConstants . DisconnectTimeoutMS ,
768
- maxFrameTimeMS = 100
778
+ maxConnectAttempts = transport . m_MaxConnectAttempts ,
779
+ connectTimeoutMS = transport . m_ConnectTimeoutMS ,
780
+ disconnectTimeoutMS = transport . m_DisconnectTimeoutMS ,
781
+ heartbeatTimeoutMS = transport . m_HeartbeatTimeoutMS ,
782
+ maxFrameTimeMS = 0
769
783
} ;
770
784
785
+ #if UNITY_EDITOR || DEVELOPMENT_BUILD
786
+ netParams . maxFrameTimeMS = 100 ;
787
+
771
788
var simulatorParams = ClientSimulatorParameters ;
772
789
transport . m_NetworkParameters . Insert ( 0 , simulatorParams ) ;
773
- transport . m_NetworkParameters . Insert ( 0 , netParams ) ;
774
790
#endif
791
+ transport . m_NetworkParameters . Insert ( 0 , netParams ) ;
792
+
775
793
if ( transport . m_NetworkParameters . Count > 0 )
776
794
{
777
795
driver = NetworkDriver . Create ( transport . m_NetworkParameters . ToArray ( ) ) ;
0 commit comments