From 960af4bb3a6c5f6fd480d7e594b09087fb6e4781 Mon Sep 17 00:00:00 2001 From: Konstantin Dyachenko Date: Tue, 7 Apr 2026 03:25:40 +0700 Subject: [PATCH] [Fix] FishNet --- Assets/DefaultPrefabObjects.asset | 2 +- .../Rigidbody/{ => Scripts}/Prefabs.meta | 0 .../Prefabs/RigidbodyPrediction.prefab | 0 .../Prefabs/RigidbodyPrediction.prefab.meta | 2 +- .../BidirectionNetworkTraffic.cs.meta | 2 +- .../Runtime/Editor/NetworkProfiler/Types.cs | 302 ------------------ .../Editor/NetworkProfiler/Types.cs.meta | 18 -- .../GameKit/Dependencies/Utilities/Guids.cs | 10 - .../Dependencies/Utilities/Guids.cs.meta | 18 -- Packages/manifest.json | 2 + Packages/packages-lock.json | 12 + 11 files changed, 17 insertions(+), 351 deletions(-) rename Assets/FishNet/Demos/Prediction/Rigidbody/{ => Scripts}/Prefabs.meta (100%) rename Assets/FishNet/Demos/Prediction/Rigidbody/{ => Scripts}/Prefabs/RigidbodyPrediction.prefab (100%) rename Assets/FishNet/Demos/Prediction/Rigidbody/{ => Scripts}/Prefabs/RigidbodyPrediction.prefab.meta (75%) delete mode 100644 Assets/FishNet/Runtime/Editor/NetworkProfiler/Types.cs delete mode 100644 Assets/FishNet/Runtime/Editor/NetworkProfiler/Types.cs.meta delete mode 100644 Assets/FishNet/Runtime/Plugins/GameKit/Dependencies/Utilities/Guids.cs delete mode 100644 Assets/FishNet/Runtime/Plugins/GameKit/Dependencies/Utilities/Guids.cs.meta diff --git a/Assets/DefaultPrefabObjects.asset b/Assets/DefaultPrefabObjects.asset index ec9afc82..d304fcc5 100644 --- a/Assets/DefaultPrefabObjects.asset +++ b/Assets/DefaultPrefabObjects.asset @@ -15,12 +15,12 @@ MonoBehaviour: _prefabs: - {fileID: 4512293259955182956, guid: fe2b65b02f0484b41aa8cfa9fbbb0e1d, type: 3} - {fileID: 4512293259955182956, guid: 35639798ad77fc145871588b25d66259, type: 3} + - {fileID: 201277550, guid: 26a567abbe21227428f5c3d309d1d73c, type: 3} - {fileID: 4512293259955182956, guid: 0d6d0f48b03b17f49a6340103cd9b9d0, type: 3} - {fileID: 8475222101369129519, guid: 8cf33e8e99a9b0c4c8f29ff725650de6, type: 3} - {fileID: 4512293259955182956, guid: dafef736ca1ae384e9a19eb672843563, type: 3} - {fileID: 201277550, guid: 5b712878ecece354ba4ffb026c0a221c, type: 3} - {fileID: 4512293259955182956, guid: b8017cef39731ba439c70fecc09488e3, type: 3} - - {fileID: 201277550, guid: 26a567abbe21227428f5c3d309d1d73c, type: 3} - {fileID: 4512293259955182956, guid: 44611030e61220d42ab7c37ba3c0ea92, type: 3} - {fileID: 8192566354860284824, guid: 6331b3542e64a564c81bc39cedf70c8d, type: 3} - {fileID: 4512293259955182956, guid: f32d4c19de900e64cb73cedcb8ba6f70, type: 3} diff --git a/Assets/FishNet/Demos/Prediction/Rigidbody/Prefabs.meta b/Assets/FishNet/Demos/Prediction/Rigidbody/Scripts/Prefabs.meta similarity index 100% rename from Assets/FishNet/Demos/Prediction/Rigidbody/Prefabs.meta rename to Assets/FishNet/Demos/Prediction/Rigidbody/Scripts/Prefabs.meta diff --git a/Assets/FishNet/Demos/Prediction/Rigidbody/Prefabs/RigidbodyPrediction.prefab b/Assets/FishNet/Demos/Prediction/Rigidbody/Scripts/Prefabs/RigidbodyPrediction.prefab similarity index 100% rename from Assets/FishNet/Demos/Prediction/Rigidbody/Prefabs/RigidbodyPrediction.prefab rename to Assets/FishNet/Demos/Prediction/Rigidbody/Scripts/Prefabs/RigidbodyPrediction.prefab diff --git a/Assets/FishNet/Demos/Prediction/Rigidbody/Prefabs/RigidbodyPrediction.prefab.meta b/Assets/FishNet/Demos/Prediction/Rigidbody/Scripts/Prefabs/RigidbodyPrediction.prefab.meta similarity index 75% rename from Assets/FishNet/Demos/Prediction/Rigidbody/Prefabs/RigidbodyPrediction.prefab.meta rename to Assets/FishNet/Demos/Prediction/Rigidbody/Scripts/Prefabs/RigidbodyPrediction.prefab.meta index 16314c63..c626be70 100644 --- a/Assets/FishNet/Demos/Prediction/Rigidbody/Prefabs/RigidbodyPrediction.prefab.meta +++ b/Assets/FishNet/Demos/Prediction/Rigidbody/Scripts/Prefabs/RigidbodyPrediction.prefab.meta @@ -10,5 +10,5 @@ AssetOrigin: productId: 207815 packageName: 'FishNet: Networking Evolved' packageVersion: 4.7.1R - assetPath: Assets/FishNet/Demos/Prediction/Rigidbody/Prefabs/RigidbodyPrediction.prefab + assetPath: Assets/FishNet/Demos/Prediction/Rigidbody/Scripts/Prefabs/RigidbodyPrediction.prefab uploadId: 892096 diff --git a/Assets/FishNet/Runtime/Editor/NetworkProfiler/BidirectionNetworkTraffic.cs.meta b/Assets/FishNet/Runtime/Editor/NetworkProfiler/BidirectionNetworkTraffic.cs.meta index 35486c7f..738a9799 100644 --- a/Assets/FishNet/Runtime/Editor/NetworkProfiler/BidirectionNetworkTraffic.cs.meta +++ b/Assets/FishNet/Runtime/Editor/NetworkProfiler/BidirectionNetworkTraffic.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 785b3b8173586e8429ac05c83e552200 +guid: 8e4a30af35ccc06478592b32c8f12540 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/FishNet/Runtime/Editor/NetworkProfiler/Types.cs b/Assets/FishNet/Runtime/Editor/NetworkProfiler/Types.cs deleted file mode 100644 index 99a7357c..00000000 --- a/Assets/FishNet/Runtime/Editor/NetworkProfiler/Types.cs +++ /dev/null @@ -1,302 +0,0 @@ -using System.Collections.Generic; -using FishNet.Managing; -using FishNet.Managing.Statistic; -using FishNet.Managing.Timing; -using FishNet.Transporting; -using GameKit.Dependencies.Utilities; -using UnityEngine; - -namespace FishNet.Editing -{ - /// - /// Used to resize a window. - /// - internal struct WindowResizeData - { - public readonly Vector2 CursorStartPosition; - public readonly Vector2 WindowStartHeight; - public readonly bool IsValid; - - public WindowResizeData(Vector2 cursorPosition, Vector2 windowHeight) - { - CursorStartPosition = cursorPosition; - WindowStartHeight = windowHeight; - - IsValid = true; - } - } - - /// - /// Used to store Inbound and Outbound traffic details. - /// - public class BidirectionalNetworkTraffic : IResettable - { - /// - /// Received traffic. - /// - internal NetworkTraffic InboundTraffic; - /// - /// Sent traffic. - /// - internal NetworkTraffic OutboundTraffic; - - /// - /// Creates a clone of this class using cache. - /// - /// - public BidirectionalNetworkTraffic CloneUsingCache() - { - if (InboundTraffic == null) - { - NetworkManagerExtensions.LogError($"One or more NetworkTraffic values is null. {nameof(BidirectionalNetworkTraffic)} cannot be cloned."); - return null; - } - - BidirectionalNetworkTraffic traffic = ResettableObjectCaches.Retrieve(); - - traffic.InboundTraffic = InboundTraffic; - traffic.OutboundTraffic = OutboundTraffic; - - return traffic; - } - - /// - /// Re-initializes by calling ResetState, then InitializeState. - /// - public void Reinitialize() - { - ResetState(); - InitializeState(); - } - - public void ResetState() - { - ResettableObjectCaches.StoreAndDefault(ref InboundTraffic); - ResettableObjectCaches.StoreAndDefault(ref OutboundTraffic); - } - - public void InitializeState() - { - InboundTraffic = ResettableObjectCaches.Retrieve(); - OutboundTraffic = ResettableObjectCaches.Retrieve(); - } - } - - internal class NetworkTraffic : IResettable - { - #region Types. - /// - /// Information about a single packet. - /// - public struct Packet - { - /// - /// Details about the packet, such as method or class name. - /// - /// This may be empty. - public string Details; - /// - /// Bytes used. - /// - public ulong Bytes; - /// - /// Originating GameObject. - /// - /// GameObject is used rather than a script reference because we do not want to risk unintentionally holding a script in memory. Unity will automatically clean up GameObjects, so they are safe to reference. - public GameObject GameObject; - public Packet(ulong bytes) : this(details: string.Empty, bytes, gameObject: null) { } - public Packet(string details, ulong bytes) : this(details, bytes, gameObject: null) { } - public Packet(ulong bytes, GameObject gameObject) : this(details: string.Empty, bytes, gameObject) { } - - public Packet(string details, ulong bytes, GameObject gameObject) - { - Details = details; - Bytes = bytes; - GameObject = gameObject; - } - } - - /// - /// Container for multiple Packets of the same type. - /// - public class PacketGroup : IResettable - { - /// - /// PacketId of this metric. - /// - public PacketId PacketId { get; private set; } = PacketId.Unset; - /// - /// Bytes of all packets using PacketId. - /// - public ulong Bytes { get; private set; } - /// - /// Percent Bytes is when compared against Bytes of other PacketMetrics. - /// - /// This can only be completed after all Packet entries for each PacketId are added. - public float Percent { get; private set; } - /// - /// True if PacketId is for unspecified packets. - /// - public bool IsUnspecifiedPacketId => PacketId == NetworkTrafficStatistics.UNSPECIFIED_PACKETID; - /// - /// Currently added packets. - /// - private List _packets = new(); - - public void Initialize(PacketId packetId) - { - PacketId = packetId; - } - // public void Initialize(PacketId packetId, ulong bytes) => Initialize(packetId, details: string.Empty, bytes, gameObject: null); - // public void Initialize(PacketId packetId, ulong bytes, GameObject gameObject) => Initialize(packetId, details: string.Empty, bytes, gameObject); - // public void Initialize(PacketId packetId, string details, ulong bytes) => Initialize(packetId, details, bytes, gameObject: null); - // public void Initialize(PacketId packetId, string details, ulong bytes, GameObject gameObject) - // { - // PacketId = packetId; - // - // _packets.Add(new(details, bytes, gameObject)); - // } - - /// - /// Adds traffic from a specified packetId. - /// - public void AddPacket(string details, ulong bytes, GameObject gameObject) - { - Bytes += bytes; - - _packets.Add(new(details, bytes, gameObject)); - } - - /// - /// Sets Percent using Bytes against allPacketGroupBytes. - /// - public void SetPercent(ulong allPacketGroupBytes) - { - //Prevent divide by 0. - if (Bytes == 0) - Percent = 0; - else - Percent = (float)Bytes / allPacketGroupBytes; - } - - public void ResetState() - { - PacketId = PacketId.Unset; - Bytes = 0; - Percent = 0f; - _packets.Clear(); - } - - public void InitializeState() { } - } - #endregion - - /// - /// PacketGroup for each PacketId processed. - /// - private Dictionary _packetGroups; - /// - /// Total bytes for all packets. - /// - public ulong Bytes; - - /// - /// Adds traffic from a specified packetId. - /// - public void AddPacketIdData(PacketId packetId, string details, ulong bytes, GameObject gameObject) => LAddPacketId(packetId, details, bytes, gameObject); - - /// - /// Adds traffic from a specified packetId. - /// - public void AddSocketData(ulong bytes) - { - LAddPacketId(NetworkTrafficStatistics.UNSPECIFIED_PACKETID, details: string.Empty, bytes, gameObject: null); - Bytes += bytes; - } - - /// - /// Adds traffic to a PackerGroup. - /// - private void LAddPacketId(PacketId packetId, string details, ulong bytes, GameObject gameObject) - { - if (!_packetGroups.TryGetValue(packetId, out PacketGroup packetGroup)) - { - packetGroup = ResettableObjectCaches.Retrieve(); - packetGroup.Initialize(packetId); - - _packetGroups[packetId] = packetGroup; - } - - packetGroup.AddPacket(details, bytes, gameObject); - } - - /// - /// Calculates and sets Percentage value on each PacketGroup. - /// - /// This should only be called after all PacketGroup entries have been created. - public void SetPacketGroupPercentages() - { - //Field would probably get cached at runtime during iteration but let's be certain. - ulong bytes = Bytes; - - foreach (PacketGroup pg in _packetGroups.Values) - pg.SetPercent(bytes); - } - - public void ResetState() - { - Bytes = 0; - ResettableT2CollectionCaches.StoreAndDefault(ref _packetGroups); - } - - public void InitializeState() - { - _packetGroups = ResettableT2CollectionCaches.RetrieveDictionary(); - } - } - - /// - /// Data for a profiled tick. - /// - internal class ProfiledTickData : IResettable - { - /// - /// Tick this is for. - /// - public uint Tick; - /// - /// Traffic collection for the server. - /// - public BidirectionalNetworkTraffic ServerTraffic; - /// - /// Traffic collection for the client. - /// - public BidirectionalNetworkTraffic ClientTraffic; - - /// - /// Initializes and returns if successful. - /// - public bool TryInitialize(uint tick, BidirectionalNetworkTraffic serverTraffic, BidirectionalNetworkTraffic clientTraffic) - { - Tick = tick; - - ServerTraffic = serverTraffic.CloneUsingCache(); - ClientTraffic = clientTraffic.CloneUsingCache(); - - return ServerTraffic != null && ClientTraffic != null; - } - - /// - /// Resets all values and stores to caches as needed. - /// - public void ResetState() - { - Tick = TimeManager.UNSET_TICK; - - ResettableObjectCaches.StoreAndDefault(ref ServerTraffic); - ResettableObjectCaches.StoreAndDefault(ref ClientTraffic); - } - - public void InitializeState() { } - } -} \ No newline at end of file diff --git a/Assets/FishNet/Runtime/Editor/NetworkProfiler/Types.cs.meta b/Assets/FishNet/Runtime/Editor/NetworkProfiler/Types.cs.meta deleted file mode 100644 index f987d57d..00000000 --- a/Assets/FishNet/Runtime/Editor/NetworkProfiler/Types.cs.meta +++ /dev/null @@ -1,18 +0,0 @@ -fileFormatVersion: 2 -guid: 8e4a30af35ccc06478592b32c8f12540 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: -AssetOrigin: - serializedVersion: 1 - productId: 207815 - packageName: 'FishNet: Networking Evolved' - packageVersion: 4.6.22R - assetPath: Assets/FishNet/Runtime/Editor/NetworkProfiler/Types.cs - uploadId: 866910 diff --git a/Assets/FishNet/Runtime/Plugins/GameKit/Dependencies/Utilities/Guids.cs b/Assets/FishNet/Runtime/Plugins/GameKit/Dependencies/Utilities/Guids.cs deleted file mode 100644 index cb7d3635..00000000 --- a/Assets/FishNet/Runtime/Plugins/GameKit/Dependencies/Utilities/Guids.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace GameKit.Dependencies.Utilities -{ - public static class Guids - { - /// - /// A buffer convert data and discard. - /// - public static byte[] Buffer = new byte[16]; - } -} \ No newline at end of file diff --git a/Assets/FishNet/Runtime/Plugins/GameKit/Dependencies/Utilities/Guids.cs.meta b/Assets/FishNet/Runtime/Plugins/GameKit/Dependencies/Utilities/Guids.cs.meta deleted file mode 100644 index 378b3c9e..00000000 --- a/Assets/FishNet/Runtime/Plugins/GameKit/Dependencies/Utilities/Guids.cs.meta +++ /dev/null @@ -1,18 +0,0 @@ -fileFormatVersion: 2 -guid: 51b4d6f1925ec014d8e37fc1d8c89c71 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: -AssetOrigin: - serializedVersion: 1 - productId: 207815 - packageName: 'FishNet: Networking Evolved' - packageVersion: 4.6.22R - assetPath: Assets/FishNet/Runtime/Plugins/GameKit/Dependencies/Utilities/Guids.cs - uploadId: 866910 diff --git a/Packages/manifest.json b/Packages/manifest.json index 8825a419..efa56557 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,5 +1,6 @@ { "dependencies": { + "com.unity.2d.sprite": "1.0.0", "com.unity.burst": "1.8.28", "com.unity.collab-proxy": "2.11.3", "com.unity.collections": "2.6.2", @@ -30,6 +31,7 @@ "com.unity.modules.jsonserialize": "1.0.0", "com.unity.modules.particlesystem": "1.0.0", "com.unity.modules.physics": "1.0.0", + "com.unity.modules.physics2d": "1.0.0", "com.unity.modules.screencapture": "1.0.0", "com.unity.modules.subsystems": "1.0.0", "com.unity.modules.terrain": "1.0.0", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index a3e4f813..5b3da38d 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -1,5 +1,11 @@ { "dependencies": { + "com.unity.2d.sprite": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, "com.unity.burst": { "version": "1.8.28", "depth": 0, @@ -295,6 +301,12 @@ "source": "builtin", "dependencies": {} }, + "com.unity.modules.physics2d": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, "com.unity.modules.screencapture": { "version": "1.0.0", "depth": 0,