From 4bebec8173b86cff446798bb2c68d6a4cb139e8c Mon Sep 17 00:00:00 2001 From: miwarnec Date: Thu, 31 Oct 2024 17:24:26 +0100 Subject: [PATCH] per NI WIP --- Assets/Mirror/Core/NetworkIdentity.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Assets/Mirror/Core/NetworkIdentity.cs b/Assets/Mirror/Core/NetworkIdentity.cs index 17c55cde6..cef93388f 100644 --- a/Assets/Mirror/Core/NetworkIdentity.cs +++ b/Assets/Mirror/Core/NetworkIdentity.cs @@ -3,6 +3,7 @@ using System.Runtime.CompilerServices; using Mirror.RemoteCalls; using UnityEngine; +using UnityEngine.Profiling; using UnityEngine.Serialization; #if UNITY_EDITOR @@ -936,6 +937,8 @@ internal static bool IsDirty(ulong mask, int index) // check ownerWritten/observersWritten to know if anything was written internal void SerializeServer(bool initialState, NetworkWriter ownerWriter, NetworkWriter observersWriter) { + // profiling marker for shallow profiling to show more than "UpdateFunction.Invoke + Profiler.BeginSample($"NetworkIdentity({name}): SerializeServer"); // TODO nonalloc // ensure NetworkBehaviours are valid before usage ValidateComponents(); NetworkBehaviour[] components = NetworkBehaviours; @@ -1004,11 +1007,16 @@ internal void SerializeServer(bool initialState, NetworkWriter ownerWriter, Netw } } } + + Profiler.EndSample(); } // serialize components into writer on the client. internal void SerializeClient(NetworkWriter writer) { + // profiling marker for shallow profiling to show more than "UpdateFunction.Invoke + Profiler.BeginSample($"NetworkIdentity({name}): SerializeClient"); // TODO nonalloc + // ensure NetworkBehaviours are valid before usage ValidateComponents(); NetworkBehaviour[] components = NetworkBehaviours; @@ -1061,6 +1069,8 @@ internal void SerializeClient(NetworkWriter writer) } } } + + Profiler.EndSample(); } // deserialize components from the client on the server.