mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkServer: CleanupSerializations helper function
This commit is contained in:
parent
2085cd387f
commit
a8630abbf6
@ -1438,6 +1438,20 @@ static Serialization GetEntitySerialization(NetworkIdentity identity)
|
||||
return serializations[identity];
|
||||
}
|
||||
|
||||
// helper function to clean up cached serializations
|
||||
static void CleanupSerializations()
|
||||
{
|
||||
// return serialized writers to pool, clear set
|
||||
// TODO this is for feature parity before push->pull change.
|
||||
// make this more simple / unnecessary later.
|
||||
foreach (Serialization entry in serializations.Values)
|
||||
{
|
||||
NetworkWriterPool.Recycle(entry.ownerWriter);
|
||||
NetworkWriterPool.Recycle(entry.observersWriter);
|
||||
}
|
||||
serializations.Clear();
|
||||
}
|
||||
|
||||
// helper function to broadcast the world to a connection
|
||||
static void BroadcastToConnection(NetworkConnectionToClient connection)
|
||||
{
|
||||
@ -1542,15 +1556,8 @@ internal static void NetworkLateUpdate()
|
||||
connection.Update();
|
||||
}
|
||||
|
||||
// return serialized writers to pool, clear set
|
||||
// TODO this is for feature parity before push->pull change.
|
||||
// make this more simple / unnecessary later.
|
||||
foreach (Serialization entry in serializations.Values)
|
||||
{
|
||||
NetworkWriterPool.Recycle(entry.ownerWriter);
|
||||
NetworkWriterPool.Recycle(entry.observersWriter);
|
||||
}
|
||||
serializations.Clear();
|
||||
// return serialized writers to pool
|
||||
CleanupSerializations();
|
||||
|
||||
// TODO this unfortunately means we still need to iterate ALL
|
||||
// spawned and not just the ones with observers. figure
|
||||
|
Loading…
Reference in New Issue
Block a user