From 664b122f441356ca0ffa4a92605a067e6427d74b Mon Sep 17 00:00:00 2001 From: michal-chrobot Date: Wed, 22 Oct 2025 22:52:55 +0200 Subject: [PATCH 1/8] Removed MULTIPLAYER_TOOLS_1_0_0_PRE_7 define usage --- .../Runtime/Metrics/NetworkMetrics.cs | 16 ---------------- .../UTP/NetworkMetricsPipelineStage.cs | 2 -- .../Runtime/Transports/UTP/UnityTransport.cs | 12 ------------ .../Runtime/Unity.Netcode.Runtime.asmdef | 5 ----- .../Runtime/Unity.Netcode.Runtime.Tests.asmdef | 5 ----- 5 files changed, 40 deletions(-) diff --git a/com.unity.netcode.gameobjects/Runtime/Metrics/NetworkMetrics.cs b/com.unity.netcode.gameobjects/Runtime/Metrics/NetworkMetrics.cs index b171932103..1e68a42819 100644 --- a/com.unity.netcode.gameobjects/Runtime/Metrics/NetworkMetrics.cs +++ b/com.unity.netcode.gameobjects/Runtime/Metrics/NetworkMetrics.cs @@ -63,7 +63,6 @@ private static string GetSceneEventTypeName(uint typeCode) private readonly EventMetric m_SceneEventSentEvent = new EventMetric(NetworkMetricTypes.SceneEventSent.Id); private readonly EventMetric m_SceneEventReceivedEvent = new EventMetric(NetworkMetricTypes.SceneEventReceived.Id); -#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 private readonly Counter m_PacketSentCounter = new Counter(NetworkMetricTypes.PacketsSent.Id) { ShouldResetOnDispatch = true, @@ -85,7 +84,6 @@ private static string GetSceneEventTypeName(uint typeCode) ShouldResetOnDispatch = true, }; private readonly Gauge m_PacketLossGauge = new Gauge(NetworkMetricTypes.PacketLoss.Id); -#endif private ulong m_NumberOfMetricsThisFrame; @@ -103,13 +101,11 @@ public NetworkMetrics() .WithMetricEvents(m_RpcSentEvent, m_RpcReceivedEvent) .WithMetricEvents(m_ServerLogSentEvent, m_ServerLogReceivedEvent) .WithMetricEvents(m_SceneEventSentEvent, m_SceneEventReceivedEvent) -#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 .WithCounters(m_PacketSentCounter, m_PacketReceivedCounter) .WithGauges(m_RttToServerGauge) .WithGauges(m_NetworkObjectsGauge) .WithGauges(m_ConnectionsGauge) .WithGauges(m_PacketLossGauge) -#endif .Build(); Dispatcher.RegisterObserver(NetcodeObserver.Observer); @@ -437,7 +433,6 @@ public void TrackSceneEventReceived(ulong senderClientId, uint sceneEventType, s public void TrackPacketSent(uint packetCount) { -#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 if (!CanSendMetrics) { return; @@ -445,12 +440,10 @@ public void TrackPacketSent(uint packetCount) m_PacketSentCounter.Increment(packetCount); IncrementMetricCount(); -#endif } public void TrackPacketReceived(uint packetCount) { -#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 if (!CanSendMetrics) { return; @@ -458,55 +451,46 @@ public void TrackPacketReceived(uint packetCount) m_PacketReceivedCounter.Increment(packetCount); IncrementMetricCount(); -#endif } public void UpdateRttToServer(int rttMilliseconds) { -#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 if (!CanSendMetrics) { return; } var rttSeconds = rttMilliseconds * 1e-3; m_RttToServerGauge.Set(rttSeconds); -#endif } public void UpdateNetworkObjectsCount(int count) { -#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 if (!CanSendMetrics) { return; } m_NetworkObjectsGauge.Set(count); -#endif } public void UpdateConnectionsCount(int count) { -#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 if (!CanSendMetrics) { return; } m_ConnectionsGauge.Set(count); -#endif } public void UpdatePacketLoss(float packetLoss) { -#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 if (!CanSendMetrics) { return; } m_PacketLossGauge.Set(packetLoss); -#endif } public void DispatchFrame() diff --git a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/NetworkMetricsPipelineStage.cs b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/NetworkMetricsPipelineStage.cs index 30c7dd2691..8eb8393d93 100644 --- a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/NetworkMetricsPipelineStage.cs +++ b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/NetworkMetricsPipelineStage.cs @@ -1,5 +1,4 @@ #if MULTIPLAYER_TOOLS -#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 using AOT; using Unity.Burst; using Unity.Collections.LowLevel.Unsafe; @@ -66,4 +65,3 @@ private static void InitializeConnection(byte* staticInstanceBuffer, int staticI } } #endif -#endif diff --git a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs index 5b71fcadbe..f284c0a261 100644 --- a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs +++ b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs @@ -597,9 +597,7 @@ public void GetDefaultPipelineConfigurations( #if UNITY_MP_TOOLS_NETSIM_IMPLEMENTATION_ENABLED NetworkPipelineStageId.Get(), #endif -#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 NetworkPipelineStageId.Get(), -#endif }; var unreliableSequencedFragmented = new NetworkPipelineStageId[] @@ -609,9 +607,7 @@ public void GetDefaultPipelineConfigurations( #if UNITY_MP_TOOLS_NETSIM_IMPLEMENTATION_ENABLED NetworkPipelineStageId.Get(), #endif -#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 NetworkPipelineStageId.Get(), -#endif }; var reliableSequenced = new NetworkPipelineStageId[] @@ -620,9 +616,7 @@ public void GetDefaultPipelineConfigurations( #if UNITY_MP_TOOLS_NETSIM_IMPLEMENTATION_ENABLED NetworkPipelineStageId.Get(), #endif -#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 NetworkPipelineStageId.Get(), -#endif }; unreliableFragmentedPipelineStages = new(unreliableFragmented, Allocator.Temp); @@ -1084,12 +1078,10 @@ protected override void OnPostLateUpdate() // current frame. m_Driver.ScheduleFlushSend(default).Complete(); -#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 if (m_NetworkManager) { ExtractNetworkMetrics(); } -#endif } base.OnPostLateUpdate(); } @@ -1099,7 +1091,6 @@ private void OnDestroy() DisposeInternals(); } -#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 private void ExtractNetworkMetrics() { if (m_NetworkManager.IsServer) @@ -1167,7 +1158,6 @@ private void ExtractNetworkMetricsFromPipeline(NetworkPipeline pipeline, Network networkMetricsContext->PacketReceivedCount = 0; } } -#endif private int ExtractRtt(NetworkConnection networkConnection) { @@ -1713,9 +1703,7 @@ public void CreateDriver( #endif } -#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 driver.RegisterPipelineStage(new NetworkMetricsPipelineStage()); -#endif GetDefaultPipelineConfigurations( out var unreliableFragmentedPipelineStages, diff --git a/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef b/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef index 7e31072bbb..598305eff1 100644 --- a/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef +++ b/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef @@ -33,11 +33,6 @@ "expression": "(0,2022.2.0a5)", "define": "UNITY_UNET_PRESENT" }, - { - "name": "com.unity.multiplayer.tools", - "expression": "1.0.0-pre.7", - "define": "MULTIPLAYER_TOOLS_1_0_0_PRE_7" - }, { "name": "Unity", "expression": "2023", diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Unity.Netcode.Runtime.Tests.asmdef b/com.unity.netcode.gameobjects/Tests/Runtime/Unity.Netcode.Runtime.Tests.asmdef index d2b3924e2a..8b4ef20e13 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Unity.Netcode.Runtime.Tests.asmdef +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Unity.Netcode.Runtime.Tests.asmdef @@ -38,11 +38,6 @@ "expression": "(0,2022.2.0a5)", "define": "UNITY_UNET_PRESENT" }, - { - "name": "com.unity.multiplayer.tools", - "expression": "1.0.0-pre.7", - "define": "MULTIPLAYER_TOOLS_1_0_0_PRE_7" - }, { "name": "com.unity.modules.physics", "expression": "", From 27dd347f486a3d1e640fd14983c280badfcadf8c Mon Sep 17 00:00:00 2001 From: michal-chrobot Date: Wed, 22 Oct 2025 22:53:20 +0200 Subject: [PATCH 2/8] Updated services package --- Examples/CharacterControllerMovingBodies/Packages/manifest.json | 2 +- Examples/OverridingScenesAndPrefabs/Packages/manifest.json | 2 +- Examples/PingTool/Packages/manifest.json | 2 +- testproject/Packages/manifest.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Examples/CharacterControllerMovingBodies/Packages/manifest.json b/Examples/CharacterControllerMovingBodies/Packages/manifest.json index de9d632e57..78d06b2065 100644 --- a/Examples/CharacterControllerMovingBodies/Packages/manifest.json +++ b/Examples/CharacterControllerMovingBodies/Packages/manifest.json @@ -11,7 +11,7 @@ "com.unity.ide.visualstudio": "2.0.22", "com.unity.netcode.gameobjects": "https://github.com/Unity-Technologies/com.unity.netcode.gameobjects.git?path=com.unity.netcode.gameobjects#develop-2.0.0", "com.unity.purchasing": "4.12.2", - "com.unity.services.multiplayer": "1.0.0-pre.1", + "com.unity.services.multiplayer": "1.2.0", "com.unity.test-framework": "1.4.5", "com.unity.timeline": "1.8.7", "com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.9", diff --git a/Examples/OverridingScenesAndPrefabs/Packages/manifest.json b/Examples/OverridingScenesAndPrefabs/Packages/manifest.json index 2ffae44925..e4a67ea8f3 100644 --- a/Examples/OverridingScenesAndPrefabs/Packages/manifest.json +++ b/Examples/OverridingScenesAndPrefabs/Packages/manifest.json @@ -12,7 +12,7 @@ "com.unity.multiplayer.center": "1.0.0", "com.unity.netcode.gameobjects": "https://github.com/Unity-Technologies/com.unity.netcode.gameobjects.git?path=com.unity.netcode.gameobjects#develop-2.0.0", "com.unity.purchasing": "4.12.2", - "com.unity.services.multiplayer": "1.0.0", + "com.unity.services.multiplayer": "1.2.0", "com.unity.test-framework": "1.4.5", "com.unity.timeline": "1.8.7", "com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.9", diff --git a/Examples/PingTool/Packages/manifest.json b/Examples/PingTool/Packages/manifest.json index 45f1b14b65..7c393e519c 100644 --- a/Examples/PingTool/Packages/manifest.json +++ b/Examples/PingTool/Packages/manifest.json @@ -12,7 +12,7 @@ "com.unity.multiplayer.playmode": "1.3.0", "com.unity.multiplayer.tools": "2.2.1", "com.unity.netcode.gameobjects": "https://github.com/Unity-Technologies/com.unity.netcode.gameobjects.git?path=com.unity.netcode.gameobjects#develop-2.0.0", - "com.unity.services.multiplayer": "1.0.0", + "com.unity.services.multiplayer": "1.2.0", "com.unity.test-framework": "1.4.5", "com.unity.timeline": "1.8.7", "com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.9", diff --git a/testproject/Packages/manifest.json b/testproject/Packages/manifest.json index 8817bf5eaf..efee7216f2 100644 --- a/testproject/Packages/manifest.json +++ b/testproject/Packages/manifest.json @@ -11,7 +11,7 @@ "com.unity.netcode.gameobjects": "file:../../com.unity.netcode.gameobjects", "com.unity.package-validation-suite": "0.49.0-preview", "com.unity.services.authentication": "3.5.2", - "com.unity.services.multiplayer": "1.1.8", + "com.unity.services.multiplayer": "1.2.0", "com.unity.test-framework": "1.6.0", "com.unity.test-framework.performance": "3.1.0", "com.unity.timeline": "1.8.9", From 251d38d1aa61693ebb591ab0c40bb8f7e0cd38a3 Mon Sep 17 00:00:00 2001 From: michal-chrobot Date: Wed, 22 Oct 2025 22:53:29 +0200 Subject: [PATCH 3/8] Updated transport dependency --- com.unity.netcode.gameobjects/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.netcode.gameobjects/package.json b/com.unity.netcode.gameobjects/package.json index 977aa4b219..071c4b3a3f 100644 --- a/com.unity.netcode.gameobjects/package.json +++ b/com.unity.netcode.gameobjects/package.json @@ -6,7 +6,7 @@ "unity": "6000.0", "dependencies": { "com.unity.nuget.mono-cecil": "1.11.4", - "com.unity.transport": "2.4.0" + "com.unity.transport": "2.6.0" }, "samples": [ { From 9882d048ca19d2af35925e7173c7be8bc14e6547 Mon Sep 17 00:00:00 2001 From: michal-chrobot Date: Wed, 22 Oct 2025 22:59:51 +0200 Subject: [PATCH 4/8] Removal of UNITY_UNET_PRESENT define --- .../Editor/HiddenScriptEditor.cs | 13 - .../Editor/Unity.Netcode.Editor.asmdef | 5 - .../Runtime/Transports/UNET/UNetTransport.cs | 308 ------------------ .../Transports/UNET/UNetTransport.cs.meta | 11 - .../Runtime/Unity.Netcode.Runtime.asmdef | 5 - .../Editor/Transports/UNetTransportTests.cs | 49 --- .../Transports/UNetTransportTests.cs.meta | 11 - .../Editor/Unity.Netcode.Editor.Tests.asmdef | 5 - .../Unity.Netcode.Runtime.Tests.asmdef | 5 - .../Assets/Scripts/CommandLineHandler.cs | 20 -- testproject/Assets/Scripts/testproject.asmdef | 5 - .../Runtime/TestProject.Runtime.Tests.asmdef | 5 - .../BaseMultiprocessTests.cs | 14 +- .../MultiprocessRuntime/TestCoordinator.cs | 14 - .../testproject.multiprocesstests.asmdef | 5 - 15 files changed, 1 insertion(+), 474 deletions(-) delete mode 100644 com.unity.netcode.gameobjects/Runtime/Transports/UNET/UNetTransport.cs delete mode 100644 com.unity.netcode.gameobjects/Runtime/Transports/UNET/UNetTransport.cs.meta delete mode 100644 com.unity.netcode.gameobjects/Tests/Editor/Transports/UNetTransportTests.cs delete mode 100644 com.unity.netcode.gameobjects/Tests/Editor/Transports/UNetTransportTests.cs.meta diff --git a/com.unity.netcode.gameobjects/Editor/HiddenScriptEditor.cs b/com.unity.netcode.gameobjects/Editor/HiddenScriptEditor.cs index e6dc823e4e..f9d18b8890 100644 --- a/com.unity.netcode.gameobjects/Editor/HiddenScriptEditor.cs +++ b/com.unity.netcode.gameobjects/Editor/HiddenScriptEditor.cs @@ -1,9 +1,6 @@ #if COM_UNITY_MODULES_ANIMATION || COM_UNITY_MODULES_PHYSICS || COM_UNITY_MODULES_PHYSICS2D using Unity.Netcode.Components; #endif -#if UNITY_UNET_PRESENT -using Unity.Netcode.Transports.UNET; -#endif using Unity.Netcode.Transports.UTP; using UnityEditor; using UnityEngine; @@ -29,16 +26,6 @@ public override void OnInspectorGUI() EditorGUI.EndChangeCheck(); } } -#if UNITY_UNET_PRESENT - /// - /// Internal use. Hides the script field for UNetTransport. - /// - [CustomEditor(typeof(UNetTransport), true)] - public class UNetTransportEditor : HiddenScriptEditor - { - - } -#endif /// /// Internal use. Hides the script field for UnityTransport. diff --git a/com.unity.netcode.gameobjects/Editor/Unity.Netcode.Editor.asmdef b/com.unity.netcode.gameobjects/Editor/Unity.Netcode.Editor.asmdef index 490c1b2d55..618fbc33b5 100644 --- a/com.unity.netcode.gameobjects/Editor/Unity.Netcode.Editor.asmdef +++ b/com.unity.netcode.gameobjects/Editor/Unity.Netcode.Editor.asmdef @@ -24,11 +24,6 @@ "expression": "", "define": "MULTIPLAYER_TOOLS" }, - { - "name": "Unity", - "expression": "(0,2022.2.0a5)", - "define": "UNITY_UNET_PRESENT" - }, { "name": "com.unity.modules.animation", "expression": "", diff --git a/com.unity.netcode.gameobjects/Runtime/Transports/UNET/UNetTransport.cs b/com.unity.netcode.gameobjects/Runtime/Transports/UNET/UNetTransport.cs deleted file mode 100644 index 474ce75eae..0000000000 --- a/com.unity.netcode.gameobjects/Runtime/Transports/UNET/UNetTransport.cs +++ /dev/null @@ -1,308 +0,0 @@ -#if UNITY_UNET_PRESENT -#pragma warning disable 618 // disable is obsolete -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member -using System; -using UnityEngine; -using UnityEngine.Networking; - -namespace Unity.Netcode.Transports.UNET -{ - [AddComponentMenu("Netcode/UNet Transport")] - public class UNetTransport : NetworkTransport - { - public enum SendMode - { - Immediately, - Queued - } - - private int m_UnreliableChannelId; - private int m_UnreliableSequencedChannelId; - private int m_ReliableChannelId; - private int m_ReliableSequencedChannelId; - private int m_ReliableFragmentedSequencedChannelId; - - // Inspector / settings - public int MessageBufferSize = 1024 * 5; - public int MaxConnections = 100; - public int MaxSentMessageQueueSize = 128; - - public string ConnectAddress = "127.0.0.1"; - public int ConnectPort = 7777; - public int ServerListenPort = 7777; - - public SendMode MessageSendMode = SendMode.Immediately; - - // Runtime / state - private byte[] m_MessageBuffer; - private WeakReference m_TemporaryBufferReference; - - // Lookup / translation - private int m_ServerConnectionId; - private int m_ServerHostId; - - public override ulong ServerClientId => GetNetcodeClientId(0, 0, true); - - internal NetworkManager NetworkManager; - - protected void LateUpdate() - { - if (UnityEngine.Networking.NetworkTransport.IsStarted && MessageSendMode == SendMode.Queued) - { -#if UNITY_WEBGL - Debug.LogError("Cannot use queued sending mode for WebGL"); -#else - if (NetworkManager != null && NetworkManager.IsServer) - { - foreach (var targetClient in NetworkManager.Singleton.ConnectedClientsList) - { - SendQueued(targetClient.ClientId); - } - } - else - { - SendQueued(NetworkManager.Singleton.LocalClientId); - } -#endif - } - } - - public override void Send(ulong clientId, ArraySegment payload, NetworkDelivery networkDelivery) - { - GetUNetConnectionDetails(clientId, out byte hostId, out ushort connectionId); - - byte[] buffer; - if (payload.Offset > 0) - { - // UNET cant handle this, do a copy - - if (m_MessageBuffer.Length >= payload.Count) - { - buffer = m_MessageBuffer; - } - else - { - object bufferRef; - if (m_TemporaryBufferReference != null && ((bufferRef = m_TemporaryBufferReference.Target) != null) && ((byte[])bufferRef).Length >= payload.Count) - { - buffer = (byte[])bufferRef; - } - else - { - buffer = new byte[payload.Count]; - m_TemporaryBufferReference = new WeakReference(buffer); - } - } - - Buffer.BlockCopy(payload.Array, payload.Offset, buffer, 0, payload.Count); - } - else - { - buffer = payload.Array; - } - - int channelId = -1; - switch (networkDelivery) - { - case NetworkDelivery.Unreliable: - channelId = m_UnreliableChannelId; - break; - case NetworkDelivery.UnreliableSequenced: - channelId = m_UnreliableSequencedChannelId; - break; - case NetworkDelivery.Reliable: - channelId = m_ReliableChannelId; - break; - case NetworkDelivery.ReliableSequenced: - channelId = m_ReliableSequencedChannelId; - break; - case NetworkDelivery.ReliableFragmentedSequenced: - channelId = m_ReliableFragmentedSequencedChannelId; - break; - } - - if (MessageSendMode == SendMode.Queued) - { -#if UNITY_WEBGL - Debug.LogError("Cannot use queued sending mode for WebGL"); -#else - UnityEngine.Networking.NetworkTransport.QueueMessageForSending(hostId, connectionId, channelId, buffer, payload.Count, out byte error); -#endif - } - else - { - UnityEngine.Networking.NetworkTransport.Send(hostId, connectionId, channelId, buffer, payload.Count, out byte error); - } - } - -#if !UNITY_WEBGL - private void SendQueued(ulong clientId) - { - GetUNetConnectionDetails(clientId, out byte hostId, out ushort connectionId); - - UnityEngine.Networking.NetworkTransport.SendQueuedMessages(hostId, connectionId, out _); - } -#endif - - public override NetworkEvent PollEvent(out ulong clientId, out ArraySegment payload, out float receiveTime) - { - var eventType = UnityEngine.Networking.NetworkTransport.Receive(out int hostId, out int connectionId, out _, m_MessageBuffer, m_MessageBuffer.Length, out int receivedSize, out byte error); - - clientId = GetNetcodeClientId((byte)hostId, (ushort)connectionId, false); - receiveTime = NetworkManager.RealTimeProvider.RealTimeSinceStartup; - - var networkError = (NetworkError)error; - if (networkError == NetworkError.MessageToLong) - { - byte[] tempBuffer; - - if (m_TemporaryBufferReference != null && m_TemporaryBufferReference.IsAlive && ((byte[])m_TemporaryBufferReference.Target).Length >= receivedSize) - { - tempBuffer = (byte[])m_TemporaryBufferReference.Target; - } - else - { - tempBuffer = new byte[receivedSize]; - m_TemporaryBufferReference = new WeakReference(tempBuffer); - } - - eventType = UnityEngine.Networking.NetworkTransport.Receive(out hostId, out connectionId, out _, tempBuffer, tempBuffer.Length, out receivedSize, out error); - payload = new ArraySegment(tempBuffer, 0, receivedSize); - } - else - { - payload = new ArraySegment(m_MessageBuffer, 0, receivedSize); - } - - if (networkError == NetworkError.Timeout) - { - // In UNET. Timeouts are not disconnects. We have to translate that here. - eventType = NetworkEventType.DisconnectEvent; - } - - // Translate NetworkEventType to NetEventType - switch (eventType) - { - case NetworkEventType.DataEvent: - return NetworkEvent.Data; - case NetworkEventType.ConnectEvent: - return NetworkEvent.Connect; - case NetworkEventType.DisconnectEvent: - return NetworkEvent.Disconnect; - case NetworkEventType.BroadcastEvent: - case NetworkEventType.Nothing: - default: - return NetworkEvent.Nothing; - } - } - - public override bool StartClient() - { - m_ServerHostId = UnityEngine.Networking.NetworkTransport.AddHost(new HostTopology(GetConfig(), 1), 0, null); - m_ServerConnectionId = UnityEngine.Networking.NetworkTransport.Connect(m_ServerHostId, ConnectAddress, GetConnectPort(), 0, out byte error); - return (NetworkError)error == NetworkError.Ok; - } - - public override bool StartServer() - { - var topology = new HostTopology(GetConfig(), MaxConnections); - // Undocumented, but AddHost returns -1 in case of any type of failure. See UNET::NetLibraryManager::AddHost - return -1 != UnityEngine.Networking.NetworkTransport.AddHost(topology, GetServerListenPort(), null); - } - - public override void DisconnectRemoteClient(ulong clientId) - { - GetUNetConnectionDetails(clientId, out byte hostId, out ushort connectionId); - - UnityEngine.Networking.NetworkTransport.Disconnect(hostId, connectionId, out byte error); - } - - public override void DisconnectLocalClient() - { - UnityEngine.Networking.NetworkTransport.Disconnect(m_ServerHostId, m_ServerConnectionId, out byte error); - } - - public override ulong GetCurrentRtt(ulong clientId) - { - GetUNetConnectionDetails(clientId, out byte hostId, out ushort connectionId); - - return (ulong)UnityEngine.Networking.NetworkTransport.GetCurrentRTT(hostId, connectionId, out byte error); - } - - public override void Shutdown() - { - UnityEngine.Networking.NetworkTransport.Shutdown(); - } - - public override void Initialize(NetworkManager networkManager = null) - { - NetworkManager = networkManager; - - m_MessageBuffer = new byte[MessageBufferSize]; - - UnityEngine.Networking.NetworkTransport.Init(); - } - - private ulong GetNetcodeClientId(byte hostId, ushort connectionId, bool isServer) - { - if (isServer) - { - return 0; - } - - return (connectionId | (ulong)hostId << 16) + 1; - } - - private void GetUNetConnectionDetails(ulong clientId, out byte hostId, out ushort connectionId) - { - if (clientId == 0) - { - hostId = (byte)m_ServerHostId; - connectionId = (ushort)m_ServerConnectionId; - } - else - { - hostId = (byte)((clientId - 1) >> 16); - connectionId = (ushort)((clientId - 1)); - } - } - - private ConnectionConfig GetConfig() - { - var connectionConfig = new ConnectionConfig(); - - m_UnreliableChannelId = connectionConfig.AddChannel(QosType.Unreliable); - m_UnreliableSequencedChannelId = connectionConfig.AddChannel(QosType.UnreliableSequenced); - m_ReliableChannelId = connectionConfig.AddChannel(QosType.Reliable); - m_ReliableSequencedChannelId = connectionConfig.AddChannel(QosType.ReliableSequenced); - m_ReliableFragmentedSequencedChannelId = connectionConfig.AddChannel(QosType.ReliableFragmentedSequenced); - - connectionConfig.MaxSentMessageQueueSize = (ushort)MaxSentMessageQueueSize; - - return connectionConfig; - } - - private int GetConnectPort() - { - if (NetworkManager && NetworkManager.PortOverride.Overidden) - { - return NetworkManager.PortOverride.Value; - } - - return ConnectPort; - } - - private int GetServerListenPort() - { - if (NetworkManager && NetworkManager.PortOverride.Overidden) - { - return NetworkManager.PortOverride.Value; - } - - return ServerListenPort; - } - } -} -#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member -#pragma warning restore 618 // restore is obsolete -#endif diff --git a/com.unity.netcode.gameobjects/Runtime/Transports/UNET/UNetTransport.cs.meta b/com.unity.netcode.gameobjects/Runtime/Transports/UNET/UNetTransport.cs.meta deleted file mode 100644 index 6af193fde7..0000000000 --- a/com.unity.netcode.gameobjects/Runtime/Transports/UNET/UNetTransport.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b84c2d8dfe509a34fb59e2b81f8e1319 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef b/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef index 598305eff1..32c36d4338 100644 --- a/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef +++ b/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef @@ -28,11 +28,6 @@ "expression": "", "define": "MULTIPLAYER_TOOLS" }, - { - "name": "Unity", - "expression": "(0,2022.2.0a5)", - "define": "UNITY_UNET_PRESENT" - }, { "name": "Unity", "expression": "2023", diff --git a/com.unity.netcode.gameobjects/Tests/Editor/Transports/UNetTransportTests.cs b/com.unity.netcode.gameobjects/Tests/Editor/Transports/UNetTransportTests.cs deleted file mode 100644 index 9cb0bda976..0000000000 --- a/com.unity.netcode.gameobjects/Tests/Editor/Transports/UNetTransportTests.cs +++ /dev/null @@ -1,49 +0,0 @@ -#if UNITY_UNET_PRESENT -#pragma warning disable 618 // disable is obsolete -using NUnit.Framework; -using Unity.Netcode.Transports.UNET; -using UnityEngine; -using UnityEngine.TestTools; - -namespace Unity.Netcode.EditorTests -{ - internal class UNetTransportTests - { - [Test] - public void StartServerReturnsFalseOnFailure() - { - UNetTransport unet1 = null; - UNetTransport unet2 = null; - - try - { - // Arrange - - // We're expecting an error from UNET, but don't care to validate the specific message - LogAssert.ignoreFailingMessages = true; - - var go = new GameObject(); - unet1 = go.AddComponent(); - unet1.ServerListenPort = 1; - unet1.Initialize(); - unet1.StartServer(); - unet2 = go.AddComponent(); - unet2.ServerListenPort = 1; - unet2.Initialize(); - - // Act - var result = unet2.StartServer(); - - // Assert - Assert.IsFalse(result, "UNET fails to initialize against port already in use"); - } - finally - { - unet1?.Shutdown(); - unet2?.Shutdown(); - } - } - } -} -#pragma warning restore 618 -#endif diff --git a/com.unity.netcode.gameobjects/Tests/Editor/Transports/UNetTransportTests.cs.meta b/com.unity.netcode.gameobjects/Tests/Editor/Transports/UNetTransportTests.cs.meta deleted file mode 100644 index 99744ac061..0000000000 --- a/com.unity.netcode.gameobjects/Tests/Editor/Transports/UNetTransportTests.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6e328ef8f7c9b46538253a1b39dc8a97 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/com.unity.netcode.gameobjects/Tests/Editor/Unity.Netcode.Editor.Tests.asmdef b/com.unity.netcode.gameobjects/Tests/Editor/Unity.Netcode.Editor.Tests.asmdef index f45952ca0e..0df6200dff 100644 --- a/com.unity.netcode.gameobjects/Tests/Editor/Unity.Netcode.Editor.Tests.asmdef +++ b/com.unity.netcode.gameobjects/Tests/Editor/Unity.Netcode.Editor.Tests.asmdef @@ -34,11 +34,6 @@ "expression": "", "define": "MULTIPLAYER_TOOLS" }, - { - "name": "Unity", - "expression": "(0,2022.2.0a5)", - "define": "UNITY_UNET_PRESENT" - }, { "name": "Unity", "expression": "6000.1.0a1", diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Unity.Netcode.Runtime.Tests.asmdef b/com.unity.netcode.gameobjects/Tests/Runtime/Unity.Netcode.Runtime.Tests.asmdef index 8b4ef20e13..3d237083f8 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Unity.Netcode.Runtime.Tests.asmdef +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Unity.Netcode.Runtime.Tests.asmdef @@ -33,11 +33,6 @@ "expression": "", "define": "MULTIPLAYER_TOOLS" }, - { - "name": "Unity", - "expression": "(0,2022.2.0a5)", - "define": "UNITY_UNET_PRESENT" - }, { "name": "com.unity.modules.physics", "expression": "", diff --git a/testproject/Assets/Scripts/CommandLineHandler.cs b/testproject/Assets/Scripts/CommandLineHandler.cs index 5c58a6cdd1..3853b2ffd7 100644 --- a/testproject/Assets/Scripts/CommandLineHandler.cs +++ b/testproject/Assets/Scripts/CommandLineHandler.cs @@ -4,9 +4,6 @@ using Unity.Netcode.Transports.UTP; using UnityEngine; using UnityEngine.SceneManagement; -#if UNITY_UNET_PRESENT -using Unity.Netcode.Transports.UNET; -#endif /// /// Provides basic command line handling capabilities @@ -216,12 +213,6 @@ private void SetTransport(string transportName) { AddUnityTransport(NetworkManager.Singleton); } -#if UNITY_UNET_PRESENT - else if (transportName.Equals("unet", StringComparison.CurrentCultureIgnoreCase)) - { - // Do nothing, this is the default - } -#endif } @@ -251,11 +242,6 @@ private void SetTransportAddress(string address) var transport = NetworkManager.Singleton.NetworkConfig.NetworkTransport; switch (transport) { -#if UNITY_UNET_PRESENT - case UNetTransport unetTransport: - unetTransport.ConnectAddress = address; - break; -#endif case UnityTransport utpTransport: { utpTransport.ConnectionData.Address = address; @@ -273,12 +259,6 @@ private void SetPort(ushort port) var transport = NetworkManager.Singleton.NetworkConfig.NetworkTransport; switch (transport) { -#if UNITY_UNET_PRESENT - case UNetTransport unetTransport: - unetTransport.ConnectPort = port; - unetTransport.ServerListenPort = port; - break; -#endif case UnityTransport utpTransport: { utpTransport.ConnectionData.Port = port; diff --git a/testproject/Assets/Scripts/testproject.asmdef b/testproject/Assets/Scripts/testproject.asmdef index 391e453cb9..942bddd1f0 100644 --- a/testproject/Assets/Scripts/testproject.asmdef +++ b/testproject/Assets/Scripts/testproject.asmdef @@ -17,11 +17,6 @@ "expression": "0.0.1-preview.3", "define": "ENABLE_RELAY_SERVICE" }, - { - "name": "Unity", - "expression": "(0,2022.2.0a5)", - "define": "UNITY_UNET_PRESENT" - }, { "name": "com.unity.addressables", "expression": "", diff --git a/testproject/Assets/Tests/Runtime/TestProject.Runtime.Tests.asmdef b/testproject/Assets/Tests/Runtime/TestProject.Runtime.Tests.asmdef index f6cbbd7806..d94d369852 100644 --- a/testproject/Assets/Tests/Runtime/TestProject.Runtime.Tests.asmdef +++ b/testproject/Assets/Tests/Runtime/TestProject.Runtime.Tests.asmdef @@ -29,11 +29,6 @@ "UNITY_INCLUDE_TESTS" ], "versionDefines": [ - { - "name": "Unity", - "expression": "(0,2022.2.0a5)", - "define": "UNITY_UNET_PRESENT" - }, { "name": "com.unity.addressables", "expression": "", diff --git a/testproject/Legacy/MultiprocessRuntime/BaseMultiprocessTests.cs b/testproject/Legacy/MultiprocessRuntime/BaseMultiprocessTests.cs index c02fb55965..8e853a0b19 100644 --- a/testproject/Legacy/MultiprocessRuntime/BaseMultiprocessTests.cs +++ b/testproject/Legacy/MultiprocessRuntime/BaseMultiprocessTests.cs @@ -7,9 +7,6 @@ using UnityEngine.SceneManagement; using UnityEngine.TestTools; using Object = UnityEngine.Object; -#if UNITY_UNET_PRESENT -using Unity.Netcode.Transports.UNET; -#endif using Unity.Netcode.Transports.UTP; @@ -40,7 +37,7 @@ protected int GetWorkerCount() /// /// Implement this to specify the amount of workers to spawn from your main test runner - /// Note: If using remote workers, the woorker count will come from the environment variable + /// Note: If using remote workers, the woorker count will come from the environment variable /// protected abstract int WorkerCount { get; } @@ -94,15 +91,6 @@ private void OnSceneLoaded(Scene scene, LoadSceneMode mode) var transport = NetworkManager.Singleton.NetworkConfig.NetworkTransport; switch (transport) { -#if UNITY_UNET_PRESENT - case UNetTransport unetTransport: - unetTransport.ConnectPort = int.Parse(TestCoordinator.Port); - unetTransport.ServerListenPort = int.Parse(TestCoordinator.Port); - unetTransport.ConnectAddress = "127.0.0.1"; - MultiprocessLogger.Log($"Setting ConnectAddress to {unetTransport.ConnectAddress} port {unetTransport.ConnectPort}, {unetTransport.ServerListenPort}"); - - break; -#endif case UnityTransport unityTransport: unityTransport.ConnectionData.ServerListenAddress = "0.0.0.0"; MultiprocessLogger.Log($"Setting unityTransport.ConnectionData.Port {unityTransport.ConnectionData.ServerListenAddress}"); diff --git a/testproject/Legacy/MultiprocessRuntime/TestCoordinator.cs b/testproject/Legacy/MultiprocessRuntime/TestCoordinator.cs index e9a7bdeb4f..a40013a9b1 100644 --- a/testproject/Legacy/MultiprocessRuntime/TestCoordinator.cs +++ b/testproject/Legacy/MultiprocessRuntime/TestCoordinator.cs @@ -7,9 +7,6 @@ using NUnit.Framework; using UnityEngine; using Unity.Netcode.MultiprocessRuntimeTests; -#if UNITY_UNET_PRESENT -using Unity.Netcode.Transports.UNET; -#endif using Unity.Netcode.Transports.UTP; /// @@ -195,17 +192,6 @@ private void SetAddressAndPort() MultiprocessLogger.Log($"transport is {transport}"); switch (transport) { -#if UNITY_UNET_PRESENT - case UNetTransport unetTransport: - unetTransport.ConnectPort = ushortport; - unetTransport.ServerListenPort = ushortport; - if (m_IsClient) - { - MultiprocessLogger.Log($"Setting ConnectAddress to {m_ConnectAddress} port {ushortport} isClient: {m_IsClient}"); - unetTransport.ConnectAddress = m_ConnectAddress; - } - break; -#endif case UnityTransport unityTransport: MultiprocessLogger.Log($"Setting unityTransport.ConnectionData.Port {ushortport}, isClient: {m_IsClient}, Address {m_ConnectAddress}"); unityTransport.ConnectionData.Port = ushortport; diff --git a/testproject/Legacy/MultiprocessRuntime/testproject.multiprocesstests.asmdef b/testproject/Legacy/MultiprocessRuntime/testproject.multiprocesstests.asmdef index 40dcb7e30c..13baf50a69 100644 --- a/testproject/Legacy/MultiprocessRuntime/testproject.multiprocesstests.asmdef +++ b/testproject/Legacy/MultiprocessRuntime/testproject.multiprocesstests.asmdef @@ -30,10 +30,5 @@ ], "noEngineReferences": false, "versionDefines": [ - { - "name": "Unity", - "expression": "(0,2022.2.0a5)", - "define": "UNITY_UNET_PRESENT" - } ] } From c991848398fa8fd0a9b5286759602e5186aa1edd Mon Sep 17 00:00:00 2001 From: michal-chrobot Date: Thu, 23 Oct 2025 10:08:09 +0200 Subject: [PATCH 5/8] changelog update --- com.unity.netcode.gameobjects/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/com.unity.netcode.gameobjects/CHANGELOG.md b/com.unity.netcode.gameobjects/CHANGELOG.md index ab7434e0fa..b7b696df64 100644 --- a/com.unity.netcode.gameobjects/CHANGELOG.md +++ b/com.unity.netcode.gameobjects/CHANGELOG.md @@ -21,12 +21,14 @@ Additional documentation and release notes are available at [Multiplayer Documen - Changed the default `NetworkDelivery` used by all messages is now reliable fragmented sequenced with the exception of named, unnamed, and any messages sent with a user specified network delivery type. This assures certain order of operations to be preserved when same call-stack changes are applied to a newly spawned, authority side, NetworkObject. (#3664) - Changed NetworkTransform documentation to better reflect the Teleport methods intended usage along with updates to NetworkObject and physics areas of the documentation. (#3664) - The first session owner no longer sends two synchronization messages to the service. (#3563) +- Updated transport dependency of the package to 2.6.0 (#3736) ### Deprecated ### Removed +- Removed usage of MULTIPLAYER_TOOLS_1_0_0_PRE_7 and UNITY_UNET_PRESENT defines (#3736) ### Fixed From 55b1cbc6643a890b5e3ffcb8520393452e189d8b Mon Sep 17 00:00:00 2001 From: michal-chrobot Date: Thu, 23 Oct 2025 10:30:48 +0200 Subject: [PATCH 6/8] Updated testproject default editor to 6000.0.51f1 --- .../Assets/AddressableAssetsData/Windows.meta | 8 ++ .../Assets/DefaultNetworkPrefabs.asset | 124 ++++++++++++++++++ testproject/Assets/Resources.meta | 8 ++ .../Tests/Runtime/MultiprocessRuntime.meta | 8 ++ testproject/Packages/packages-lock.json | 38 +++--- .../ProjectSettings/MultiplayerManager.asset | 7 + .../CustomColorSettings.asset | 17 +++ .../ProjectSettings/ProjectSettings.asset | 95 +++++++++++++- .../ProjectSettings/ProjectVersion.txt | 4 +- 9 files changed, 286 insertions(+), 23 deletions(-) create mode 100644 testproject/Assets/AddressableAssetsData/Windows.meta create mode 100644 testproject/Assets/Resources.meta create mode 100644 testproject/Assets/Tests/Runtime/MultiprocessRuntime.meta create mode 100644 testproject/ProjectSettings/MultiplayerManager.asset create mode 100644 testproject/ProjectSettings/Packages/com.unity.multiplayer.tools/CustomColorSettings.asset diff --git a/testproject/Assets/AddressableAssetsData/Windows.meta b/testproject/Assets/AddressableAssetsData/Windows.meta new file mode 100644 index 0000000000..782199ed29 --- /dev/null +++ b/testproject/Assets/AddressableAssetsData/Windows.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e1c56f30d6e02ac47995feb9b9b79980 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/testproject/Assets/DefaultNetworkPrefabs.asset b/testproject/Assets/DefaultNetworkPrefabs.asset index a5e491547f..3d5176e97a 100644 --- a/testproject/Assets/DefaultNetworkPrefabs.asset +++ b/testproject/Assets/DefaultNetworkPrefabs.asset @@ -224,3 +224,127 @@ MonoBehaviour: SourcePrefabToOverride: {fileID: 0} SourceHashToOverride: 0 OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 8133991607019124060, guid: c3f26b8822ab9ec4dbda31fd1bb9965d, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 6994329648695279756, guid: 5c4a10e01b6668147ba4ccda6a584181, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 479369275288778692, guid: 4d47e418fec779e4eb616d66d61c3231, type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 296612175404815451, guid: 61e89146f864ef2478af3da9d7dda1e2, type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 296612175404815451, guid: 280da53b37f0d2546ab4d7b7da446545, type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 5507278367988661157, guid: c2db148a1fac379449a31b5430f4c6ac, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 5911443254905569495, guid: 1e7fa5aea121ba0459459b497c2f03e8, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 1488386875393216933, guid: 7752ac8c0bfaed64c8de839537204114, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 8188135024827620138, guid: c000e98bc12da2941a59ec61c260dd6a, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 5911443254905569495, guid: d88eb84e4c4e82b4b81d577a6c8e818e, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 296612175404815451, guid: fda785b5a15c5a94f9f3e93e635827a7, type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 5911443254905569495, guid: 67daf9621f0d6d74c9a9bb4f81438061, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 5911443254905569495, guid: 12cead04031f30a4aaae7427341502fa, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 4575260563898367230, guid: 4a05b9aab67281141953cf6878506d5c, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 1923233254652950715, guid: d166e48a59e24924199f3ec3b2bc3b64, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 479369275288778692, guid: ce3279d5e4f8e0342acdb2ce118f2be5, type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 6307603743893504780, guid: 0a46b240b37c5b74786b1938e8fd2eae, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 6994329648695279756, guid: a67d0c2ee5d39fb4f9f0667f244d9e58, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 771575417923360811, guid: d7447e326e807754d81428939a14058f, type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 296612175404815451, guid: 9501b2f26df3884488e1699035fd634b, type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 6958138586392507362, guid: 4b31f769283d3c24ca2a5d6baf28a806, + type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} + - Override: 0 + Prefab: {fileID: 771575417923360811, guid: 44d487c39a833b445beef6e9e39a5731, type: 3} + SourcePrefabToOverride: {fileID: 0} + SourceHashToOverride: 0 + OverridingTargetPrefab: {fileID: 0} diff --git a/testproject/Assets/Resources.meta b/testproject/Assets/Resources.meta new file mode 100644 index 0000000000..91a656ed93 --- /dev/null +++ b/testproject/Assets/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 44571e6c637e2294b85706420139de4e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/testproject/Assets/Tests/Runtime/MultiprocessRuntime.meta b/testproject/Assets/Tests/Runtime/MultiprocessRuntime.meta new file mode 100644 index 0000000000..7b7a5a60e0 --- /dev/null +++ b/testproject/Assets/Tests/Runtime/MultiprocessRuntime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6b710c9804908b540bc70956cfce8a14 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/testproject/Packages/packages-lock.json b/testproject/Packages/packages-lock.json index c87b451b63..fba8ef0b75 100644 --- a/testproject/Packages/packages-lock.json +++ b/testproject/Packages/packages-lock.json @@ -27,7 +27,7 @@ }, "com.unity.burst": { "version": "1.8.24", - "depth": 1, + "depth": 2, "source": "registry", "dependencies": { "com.unity.mathematics": "1.2.1", @@ -43,14 +43,13 @@ "url": "https://packages.unity.com" }, "com.unity.collections": { - "version": "2.5.7", + "version": "2.5.1", "depth": 1, "source": "registry", "dependencies": { - "com.unity.burst": "1.8.19", - "com.unity.mathematics": "1.3.2", - "com.unity.test-framework": "1.4.6", - "com.unity.nuget.mono-cecil": "1.11.5", + "com.unity.burst": "1.8.17", + "com.unity.test-framework": "1.4.5", + "com.unity.nuget.mono-cecil": "1.11.4", "com.unity.test-framework.performance": "3.0.3" }, "url": "https://packages.unity.com" @@ -107,11 +106,11 @@ "source": "local", "dependencies": { "com.unity.nuget.mono-cecil": "1.11.4", - "com.unity.transport": "2.4.0" + "com.unity.transport": "2.6.0" } }, "com.unity.nuget.mono-cecil": { - "version": "1.11.5", + "version": "1.11.4", "depth": 1, "source": "registry", "dependencies": {}, @@ -174,11 +173,11 @@ "url": "https://packages.unity.com" }, "com.unity.services.deployment": { - "version": "1.4.1", + "version": "1.6.2", "depth": 1, "source": "registry", "dependencies": { - "com.unity.services.core": "1.12.0", + "com.unity.services.core": "1.15.1", "com.unity.services.deployment.api": "1.1.2" }, "url": "https://packages.unity.com" @@ -191,19 +190,19 @@ "url": "https://packages.unity.com" }, "com.unity.services.multiplayer": { - "version": "1.1.8", + "version": "1.2.0", "depth": 0, "source": "registry", "dependencies": { "com.unity.transport": "2.5.0", "com.unity.collections": "2.2.1", "com.unity.services.qos": "1.3.0", - "com.unity.services.core": "1.13.0", + "com.unity.services.core": "1.15.1", "com.unity.services.wire": "1.4.0", - "com.unity.services.deployment": "1.3.0", + "com.unity.services.deployment": "1.6.2", "com.unity.nuget.newtonsoft-json": "3.2.1", "com.unity.modules.unitywebrequest": "1.0.0", - "com.unity.services.authentication": "3.3.3" + "com.unity.services.authentication": "3.5.1" }, "url": "https://packages.unity.com" }, @@ -232,7 +231,7 @@ "url": "https://packages.unity.com" }, "com.unity.test-framework": { - "version": "1.6.0", + "version": "1.5.1", "depth": 0, "source": "builtin", "dependencies": { @@ -264,13 +263,13 @@ "url": "https://packages.unity.com" }, "com.unity.transport": { - "version": "2.5.3", + "version": "2.6.0", "depth": 1, "source": "registry", "dependencies": { - "com.unity.burst": "1.8.12", + "com.unity.burst": "1.8.24", "com.unity.collections": "2.2.1", - "com.unity.mathematics": "1.3.1" + "com.unity.mathematics": "1.3.2" }, "url": "https://packages.unity.com" }, @@ -431,8 +430,7 @@ "com.unity.modules.ui": "1.0.0", "com.unity.modules.imgui": "1.0.0", "com.unity.modules.jsonserialize": "1.0.0", - "com.unity.modules.hierarchycore": "1.0.0", - "com.unity.modules.physics": "1.0.0" + "com.unity.modules.hierarchycore": "1.0.0" } }, "com.unity.modules.umbra": { diff --git a/testproject/ProjectSettings/MultiplayerManager.asset b/testproject/ProjectSettings/MultiplayerManager.asset new file mode 100644 index 0000000000..2a936644e0 --- /dev/null +++ b/testproject/ProjectSettings/MultiplayerManager.asset @@ -0,0 +1,7 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!655991488 &1 +MultiplayerManager: + m_ObjectHideFlags: 0 + m_EnableMultiplayerRoles: 0 + m_StrippingTypes: {} diff --git a/testproject/ProjectSettings/Packages/com.unity.multiplayer.tools/CustomColorSettings.asset b/testproject/ProjectSettings/Packages/com.unity.multiplayer.tools/CustomColorSettings.asset new file mode 100644 index 0000000000..0f059e0cd3 --- /dev/null +++ b/testproject/ProjectSettings/Packages/com.unity.multiplayer.tools/CustomColorSettings.asset @@ -0,0 +1,17 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &1 +MonoBehaviour: + m_ObjectHideFlags: 53 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6762c37d3236e2a4382cd018dcdf221e, type: 3} + m_Name: + m_EditorClassIdentifier: + colors: + m_Keys: + m_Values: [] diff --git a/testproject/ProjectSettings/ProjectSettings.asset b/testproject/ProjectSettings/ProjectSettings.asset index 492e94571c..5dafbe1407 100644 --- a/testproject/ProjectSettings/ProjectSettings.asset +++ b/testproject/ProjectSettings/ProjectSettings.asset @@ -287,7 +287,99 @@ PlayerSettings: AndroidReportGooglePlayAppDependencies: 1 androidSymbolsSizeThreshold: 800 m_BuildTargetIcons: [] - m_BuildTargetPlatformIcons: [] + m_BuildTargetPlatformIcons: + - m_BuildTarget: Android + m_Icons: + - m_Textures: [] + m_Width: 432 + m_Height: 432 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 324 + m_Height: 324 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 216 + m_Height: 216 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 162 + m_Height: 162 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 108 + m_Height: 108 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 81 + m_Height: 81 + m_Kind: 2 + m_SubKind: + - m_Textures: [] + m_Width: 192 + m_Height: 192 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 144 + m_Height: 144 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 96 + m_Height: 96 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 72 + m_Height: 72 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 48 + m_Height: 48 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 36 + m_Height: 36 + m_Kind: 1 + m_SubKind: + - m_Textures: [] + m_Width: 192 + m_Height: 192 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 144 + m_Height: 144 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 96 + m_Height: 96 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 72 + m_Height: 72 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 48 + m_Height: 48 + m_Kind: 0 + m_SubKind: + - m_Textures: [] + m_Width: 36 + m_Height: 36 + m_Kind: 0 + m_SubKind: m_BuildTargetBatching: - m_BuildTarget: Standalone m_StaticBatching: 1 @@ -367,6 +459,7 @@ PlayerSettings: iPhone: 1 tvOS: 1 m_BuildTargetGroupLightmapEncodingQuality: [] + m_BuildTargetGroupHDRCubemapEncodingQuality: [] m_BuildTargetGroupLightmapSettings: [] m_BuildTargetGroupLoadStoreDebugModeSettings: [] m_BuildTargetNormalMapEncoding: [] diff --git a/testproject/ProjectSettings/ProjectVersion.txt b/testproject/ProjectSettings/ProjectVersion.txt index 307f912404..fd1456820c 100644 --- a/testproject/ProjectSettings/ProjectVersion.txt +++ b/testproject/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 6000.0.38f1 -m_EditorVersionWithRevision: 6000.0.38f1 (82314a941f2d) +m_EditorVersion: 6000.0.51f1 +m_EditorVersionWithRevision: 6000.0.51f1 (01c3ff5872c5) From ea44509d4272a4ab3b6de5a89e98867c0b0f03e8 Mon Sep 17 00:00:00 2001 From: michal-chrobot Date: Thu, 23 Oct 2025 11:22:26 +0200 Subject: [PATCH 7/8] Removed UNET.meta file --- .../Runtime/Transports/UNET.meta | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 com.unity.netcode.gameobjects/Runtime/Transports/UNET.meta diff --git a/com.unity.netcode.gameobjects/Runtime/Transports/UNET.meta b/com.unity.netcode.gameobjects/Runtime/Transports/UNET.meta deleted file mode 100644 index 44298182e6..0000000000 --- a/com.unity.netcode.gameobjects/Runtime/Transports/UNET.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 901256c415b484744b9da9551d85073a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: From 612f8b6d366fc9fb041f1a16f60d8e23b4e55b08 Mon Sep 17 00:00:00 2001 From: michal-chrobot Date: Thu, 23 Oct 2025 11:25:13 +0200 Subject: [PATCH 8/8] Reverted removal of Tools define --- com.unity.netcode.gameobjects/CHANGELOG.md | 2 +- .../Runtime/Metrics/NetworkMetrics.cs | 16 ++++++++++++++++ .../UTP/NetworkMetricsPipelineStage.cs | 2 ++ .../Runtime/Transports/UTP/UnityTransport.cs | 12 ++++++++++++ .../Runtime/Unity.Netcode.Runtime.asmdef | 5 +++++ .../Runtime/Unity.Netcode.Runtime.Tests.asmdef | 5 +++++ 6 files changed, 41 insertions(+), 1 deletion(-) diff --git a/com.unity.netcode.gameobjects/CHANGELOG.md b/com.unity.netcode.gameobjects/CHANGELOG.md index 1c4a302f91..765e5778f6 100644 --- a/com.unity.netcode.gameobjects/CHANGELOG.md +++ b/com.unity.netcode.gameobjects/CHANGELOG.md @@ -30,7 +30,7 @@ Additional documentation and release notes are available at [Multiplayer Documen ### Removed -- Removed usage of MULTIPLAYER_TOOLS_1_0_0_PRE_7 and UNITY_UNET_PRESENT defines (#3736) +- Removed usage of UNITY_UNET_PRESENT define (#3736) ### Fixed diff --git a/com.unity.netcode.gameobjects/Runtime/Metrics/NetworkMetrics.cs b/com.unity.netcode.gameobjects/Runtime/Metrics/NetworkMetrics.cs index 1e68a42819..b171932103 100644 --- a/com.unity.netcode.gameobjects/Runtime/Metrics/NetworkMetrics.cs +++ b/com.unity.netcode.gameobjects/Runtime/Metrics/NetworkMetrics.cs @@ -63,6 +63,7 @@ private static string GetSceneEventTypeName(uint typeCode) private readonly EventMetric m_SceneEventSentEvent = new EventMetric(NetworkMetricTypes.SceneEventSent.Id); private readonly EventMetric m_SceneEventReceivedEvent = new EventMetric(NetworkMetricTypes.SceneEventReceived.Id); +#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 private readonly Counter m_PacketSentCounter = new Counter(NetworkMetricTypes.PacketsSent.Id) { ShouldResetOnDispatch = true, @@ -84,6 +85,7 @@ private static string GetSceneEventTypeName(uint typeCode) ShouldResetOnDispatch = true, }; private readonly Gauge m_PacketLossGauge = new Gauge(NetworkMetricTypes.PacketLoss.Id); +#endif private ulong m_NumberOfMetricsThisFrame; @@ -101,11 +103,13 @@ public NetworkMetrics() .WithMetricEvents(m_RpcSentEvent, m_RpcReceivedEvent) .WithMetricEvents(m_ServerLogSentEvent, m_ServerLogReceivedEvent) .WithMetricEvents(m_SceneEventSentEvent, m_SceneEventReceivedEvent) +#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 .WithCounters(m_PacketSentCounter, m_PacketReceivedCounter) .WithGauges(m_RttToServerGauge) .WithGauges(m_NetworkObjectsGauge) .WithGauges(m_ConnectionsGauge) .WithGauges(m_PacketLossGauge) +#endif .Build(); Dispatcher.RegisterObserver(NetcodeObserver.Observer); @@ -433,6 +437,7 @@ public void TrackSceneEventReceived(ulong senderClientId, uint sceneEventType, s public void TrackPacketSent(uint packetCount) { +#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 if (!CanSendMetrics) { return; @@ -440,10 +445,12 @@ public void TrackPacketSent(uint packetCount) m_PacketSentCounter.Increment(packetCount); IncrementMetricCount(); +#endif } public void TrackPacketReceived(uint packetCount) { +#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 if (!CanSendMetrics) { return; @@ -451,46 +458,55 @@ public void TrackPacketReceived(uint packetCount) m_PacketReceivedCounter.Increment(packetCount); IncrementMetricCount(); +#endif } public void UpdateRttToServer(int rttMilliseconds) { +#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 if (!CanSendMetrics) { return; } var rttSeconds = rttMilliseconds * 1e-3; m_RttToServerGauge.Set(rttSeconds); +#endif } public void UpdateNetworkObjectsCount(int count) { +#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 if (!CanSendMetrics) { return; } m_NetworkObjectsGauge.Set(count); +#endif } public void UpdateConnectionsCount(int count) { +#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 if (!CanSendMetrics) { return; } m_ConnectionsGauge.Set(count); +#endif } public void UpdatePacketLoss(float packetLoss) { +#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 if (!CanSendMetrics) { return; } m_PacketLossGauge.Set(packetLoss); +#endif } public void DispatchFrame() diff --git a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/NetworkMetricsPipelineStage.cs b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/NetworkMetricsPipelineStage.cs index 8eb8393d93..30c7dd2691 100644 --- a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/NetworkMetricsPipelineStage.cs +++ b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/NetworkMetricsPipelineStage.cs @@ -1,4 +1,5 @@ #if MULTIPLAYER_TOOLS +#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 using AOT; using Unity.Burst; using Unity.Collections.LowLevel.Unsafe; @@ -65,3 +66,4 @@ private static void InitializeConnection(byte* staticInstanceBuffer, int staticI } } #endif +#endif diff --git a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs index f284c0a261..5b71fcadbe 100644 --- a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs +++ b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs @@ -597,7 +597,9 @@ public void GetDefaultPipelineConfigurations( #if UNITY_MP_TOOLS_NETSIM_IMPLEMENTATION_ENABLED NetworkPipelineStageId.Get(), #endif +#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 NetworkPipelineStageId.Get(), +#endif }; var unreliableSequencedFragmented = new NetworkPipelineStageId[] @@ -607,7 +609,9 @@ public void GetDefaultPipelineConfigurations( #if UNITY_MP_TOOLS_NETSIM_IMPLEMENTATION_ENABLED NetworkPipelineStageId.Get(), #endif +#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 NetworkPipelineStageId.Get(), +#endif }; var reliableSequenced = new NetworkPipelineStageId[] @@ -616,7 +620,9 @@ public void GetDefaultPipelineConfigurations( #if UNITY_MP_TOOLS_NETSIM_IMPLEMENTATION_ENABLED NetworkPipelineStageId.Get(), #endif +#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 NetworkPipelineStageId.Get(), +#endif }; unreliableFragmentedPipelineStages = new(unreliableFragmented, Allocator.Temp); @@ -1078,10 +1084,12 @@ protected override void OnPostLateUpdate() // current frame. m_Driver.ScheduleFlushSend(default).Complete(); +#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 if (m_NetworkManager) { ExtractNetworkMetrics(); } +#endif } base.OnPostLateUpdate(); } @@ -1091,6 +1099,7 @@ private void OnDestroy() DisposeInternals(); } +#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 private void ExtractNetworkMetrics() { if (m_NetworkManager.IsServer) @@ -1158,6 +1167,7 @@ private void ExtractNetworkMetricsFromPipeline(NetworkPipeline pipeline, Network networkMetricsContext->PacketReceivedCount = 0; } } +#endif private int ExtractRtt(NetworkConnection networkConnection) { @@ -1703,7 +1713,9 @@ public void CreateDriver( #endif } +#if MULTIPLAYER_TOOLS_1_0_0_PRE_7 driver.RegisterPipelineStage(new NetworkMetricsPipelineStage()); +#endif GetDefaultPipelineConfigurations( out var unreliableFragmentedPipelineStages, diff --git a/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef b/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef index 32c36d4338..e76f8e8360 100644 --- a/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef +++ b/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef @@ -28,6 +28,11 @@ "expression": "", "define": "MULTIPLAYER_TOOLS" }, + { + "name": "com.unity.multiplayer.tools", + "expression": "1.0.0-pre.7", + "define": "MULTIPLAYER_TOOLS_1_0_0_PRE_7" + }, { "name": "Unity", "expression": "2023", diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Unity.Netcode.Runtime.Tests.asmdef b/com.unity.netcode.gameobjects/Tests/Runtime/Unity.Netcode.Runtime.Tests.asmdef index 3d237083f8..cde139b07f 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Unity.Netcode.Runtime.Tests.asmdef +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Unity.Netcode.Runtime.Tests.asmdef @@ -33,6 +33,11 @@ "expression": "", "define": "MULTIPLAYER_TOOLS" }, + { + "name": "com.unity.multiplayer.tools", + "expression": "1.0.0-pre.7", + "define": "MULTIPLAYER_TOOLS_1_0_0_PRE_7" + }, { "name": "com.unity.modules.physics", "expression": "",