mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
nonalloc
This commit is contained in:
parent
4bebec8173
commit
bf4f0b5acb
@ -225,6 +225,9 @@ internal set
|
||||
static readonly Dictionary<ulong, NetworkIdentity> sceneIds =
|
||||
new Dictionary<ulong, NetworkIdentity>();
|
||||
|
||||
// profiling: cache the serialization string to avoid runtime allocations
|
||||
string profilingSerializationTag = $"NetworkIdentity: Serialize"; // set to {name} in Awake
|
||||
|
||||
// Helper function to handle Command/Rpc
|
||||
internal void HandleRemoteCall(byte componentIndex, ushort functionHash, RemoteCallType remoteCallType, NetworkReader reader, NetworkConnectionToClient senderConnection = null)
|
||||
{
|
||||
@ -333,6 +336,9 @@ void ValidateComponents()
|
||||
// internal so we can call it during unit tests too.
|
||||
internal void Awake()
|
||||
{
|
||||
// cache profiling string to avoid runtime allocations
|
||||
profilingSerializationTag = $"NetworkIdentity: Serialize {name}";
|
||||
|
||||
// initialize NetworkBehaviour components.
|
||||
// Awake() is called immediately after initialization.
|
||||
// no one can overwrite it because NetworkIdentity is sealed.
|
||||
@ -938,7 +944,8 @@ internal static bool IsDirty(ulong mask, int index)
|
||||
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
|
||||
Profiler.BeginSample($"NetworkIdentity: Serialize {name}"); // TODO nonalloc
|
||||
|
||||
// ensure NetworkBehaviours are valid before usage
|
||||
ValidateComponents();
|
||||
NetworkBehaviour[] components = NetworkBehaviours;
|
||||
@ -1015,7 +1022,7 @@ internal void SerializeServer(bool initialState, NetworkWriter ownerWriter, Netw
|
||||
internal void SerializeClient(NetworkWriter writer)
|
||||
{
|
||||
// profiling marker for shallow profiling to show more than "UpdateFunction.Invoke
|
||||
Profiler.BeginSample($"NetworkIdentity({name}): SerializeClient"); // TODO nonalloc
|
||||
Profiler.BeginSample($"NetworkIdentity: Serialize {name}"); // TODO nonalloc
|
||||
|
||||
// ensure NetworkBehaviours are valid before usage
|
||||
ValidateComponents();
|
||||
|
Loading…
Reference in New Issue
Block a user