Skip to content

Commit 370b459

Browse files
committed
Address review comments TODO cleanup
1 parent 8d5f45d commit 370b459

File tree

5 files changed

+13
-16
lines changed

5 files changed

+13
-16
lines changed

Examples/OverridingScenesAndPrefabs/Packages/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"com.unity.services.multiplayer": "1.2.0",
1616
"com.unity.test-framework": "1.6.0",
1717
"com.unity.timeline": "1.8.9",
18-
"com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.11",
18+
"com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.10",
1919
"com.unity.transport": "2.6.0",
2020
"com.unity.ugui": "2.0.0",
2121
"com.unity.visualscripting": "1.9.7",

Examples/OverridingScenesAndPrefabs/Packages/packages-lock.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@
334334
"url": "https://packages.unity.com"
335335
},
336336
"com.unity.toolchain.win-x86_64-linux-x86_64": {
337-
"version": "2.0.11",
337+
"version": "2.0.10",
338338
"depth": 0,
339339
"source": "registry",
340340
"dependencies": {

Examples/OverridingScenesAndPrefabs/ProjectSettings/ProjectSettings.asset

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ PlayerSettings:
7070
androidStartInFullscreen: 1
7171
androidRenderOutsideSafeArea: 1
7272
androidUseSwappy: 1
73-
androidDisplayOptions: 1
7473
androidBlitType: 0
7574
androidResizeableActivity: 1
7675
androidDefaultWindowWidth: 1920
@@ -87,7 +86,6 @@ PlayerSettings:
8786
muteOtherAudioSources: 0
8887
Prepare IOS For Recording: 0
8988
Force IOS Speakers When Recording: 0
90-
audioSpatialExperience: 0
9189
deferSystemGesturesMode: 0
9290
hideHomeButton: 0
9391
submitAnalytics: 1
@@ -273,9 +271,6 @@ PlayerSettings:
273271
AndroidBuildApkPerCpuArchitecture: 0
274272
AndroidTVCompatibility: 0
275273
AndroidIsGame: 1
276-
androidAppCategory: 3
277-
useAndroidAppCategory: 1
278-
androidAppCategoryOther:
279274
AndroidEnableTango: 0
280275
androidEnableBanner: 1
281276
androidUseLowAccuracyLocation: 0
@@ -403,7 +398,6 @@ PlayerSettings:
403398
iPhone: 1
404399
tvOS: 1
405400
m_BuildTargetGroupLightmapEncodingQuality: []
406-
m_BuildTargetGroupHDRCubemapEncodingQuality: []
407401
m_BuildTargetGroupLightmapSettings: []
408402
m_BuildTargetGroupLoadStoreDebugModeSettings: []
409403
m_BuildTargetNormalMapEncoding: []

com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -819,13 +819,13 @@ private string GetArg(string[] commandLineArgs, string arg)
819819
return null;
820820
}
821821

822-
private bool ParseCommandLineOptions(out int port)
822+
private bool ParseCommandLineOptions(out ushort port)
823823
{
824824
#if UNITY_SERVER && UNITY_DEDICATED_SERVER_ARGUMENTS_PRESENT
825825

826826
if (UnityEngine.DedicatedServer.Arguments.Port != null)
827827
{
828-
port = UnityEngine.DedicatedServer.Arguments.Port.Value;
828+
port = (ushort)UnityEngine.DedicatedServer.Arguments.Port;
829829
return true;
830830
}
831831

@@ -846,12 +846,13 @@ private bool ParseCommandLineOptions(out int port)
846846
/// <param name="ipv4Address">The remote IP address (despite the name, can be an IPv6 address or a domain name).</param>
847847
/// <param name="port">The remote port to connect to.</param>
848848
/// <param name="listenAddress">The address the server is going to listen on.</param>
849-
/// <param name="forceOverrideCommandLineArgs">Should override port value</param>
849+
/// <param name="forceOverrideCommandLineArgs">When true, any command line arguments will be ignored.</param>
850850
public void SetConnectionData(string ipv4Address, ushort port, string listenAddress = null, bool forceOverrideCommandLineArgs = false)
851851
{
852-
if (!forceOverrideCommandLineArgs)
852+
m_HasForcedConnectionData = forceOverrideCommandLineArgs;
853+
if (!forceOverrideCommandLineArgs && ParseCommandLineOptions(out var commandLinePort))
853854
{
854-
port = ParseCommandLineOptions(out var newPort) ? (ushort)newPort : ConnectionData.Port;
855+
port = commandLinePort;
855856
}
856857

857858
ConnectionData = new ConnectionAddressData
@@ -1607,7 +1608,9 @@ protected override string GetDisconnectEventMessage(DisconnectEvents disconnectE
16071608
return m_UnityTransportNotificationHandler.GetDisconnectEventMessage(disconnectEvent);
16081609
}
16091610

1610-
1611+
/// <summary>
1612+
/// This is set in <see cref="SetConnectionData(string, ushort, string, bool)"/>
1613+
/// </summary>
16111614
private bool m_HasForcedConnectionData;
16121615

16131616
/// <summary>
@@ -1626,7 +1629,7 @@ public override void Initialize(NetworkManager networkManager = null)
16261629

16271630
m_NetworkManager = networkManager;
16281631

1629-
if (m_HasForcedConnectionData && ParseCommandLineOptions(out var port))
1632+
if (!m_HasForcedConnectionData && ParseCommandLineOptions(out var port))
16301633
{
16311634
if (m_NetworkManager?.LogLevel <= LogLevel.Developer)
16321635
{

testproject/Assets/Scripts/ServerTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ private void Start()
1717
{
1818
ushort port = 8889;
1919
Debug.Log("Start Server Port " + port); // <---- Start Server Port 8888
20-
m_Transport.SetConnectionData("0.0.0.0", port, forceOverrideCommandLineArgs: true); // <---- Port set to 8888
20+
// m_Transport.SetConnectionData("0.0.0.0", port, forceOverrideCommandLineArgs: false); // <---- Port set to true 8888 false 9999
2121
m_Network.StartServer();
2222
Debug.Log("Server listening on port: " + m_Transport.ConnectionData.Port); // <---- Shows Server listening on port: 7777
2323
}

0 commit comments

Comments
 (0)