File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
com.unity.netcode.gameobjects/Runtime/Transports/UTP Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1633,13 +1633,20 @@ public override void Initialize(NetworkManager networkManager = null)
16331633 m_NetworkManager = networkManager ;
16341634
16351635 //If the port doesn't have a forced value and is set by a command line option, override it.
1636- if ( ! m_HasForcedConnectionData && ParseCommandLineOptionsAddress ( out var port ) )
1636+ if ( ! m_HasForcedConnectionData && ParseCommandLineOptionsAddress ( out var portAsString ) )
16371637 {
16381638 if ( m_NetworkManager ? . LogLevel <= LogLevel . Developer )
16391639 {
1640- Debug . Log ( $ "The port is set by a command line option. Using following connection data: { ConnectionData . Address } :{ port } ") ;
1640+ Debug . Log ( $ "The port is set by a command line option. Using following connection data: { ConnectionData . Address } :{ portAsString } ") ;
1641+ }
1642+ if ( UInt16 . TryParse ( portAsString , out ushort port ) )
1643+ {
1644+ ConnectionData . Port = port ;
1645+ }
1646+ else
1647+ {
1648+ Debug . LogError ( $ "The port ({ portAsString } ) is not a valid unsigned short value!") ;
16411649 }
1642- ConnectionData . Port = port ;
16431650 }
16441651
16451652 m_RealTimeProvider = m_NetworkManager ? m_NetworkManager . RealTimeProvider : new RealTimeProvider ( ) ;
You can’t perform that action at this time.
0 commit comments