This commit is contained in:
vis2k 2022-10-02 09:43:35 +07:00
parent 1b562c7b6a
commit 61295a5120
2 changed files with 10 additions and 4 deletions

View File

@ -504,7 +504,7 @@ internal static void OnTransportData(int connectionId, ArraySegment<byte> data,
// the next time. // the next time.
// => consider moving processing to NetworkEarlyUpdate. // => consider moving processing to NetworkEarlyUpdate.
while (!isLoadingScene && while (!isLoadingScene &&
connection.unbatcher.GetNextMessage(out NetworkReader reader, out double remoteTimestamp)) connection.unbatcher.GetNextMessage(out NetworkReader reader, out double remoteTimestamp))
{ {
// enough to read at least header size? // enough to read at least header size?
if (reader.Remaining >= NetworkMessages.IdSize) if (reader.Remaining >= NetworkMessages.IdSize)
@ -900,7 +900,10 @@ internal static void ShowForConnection(NetworkIdentity identity, NetworkConnecti
internal static void HideForConnection(NetworkIdentity identity, NetworkConnection conn) internal static void HideForConnection(NetworkIdentity identity, NetworkConnection conn)
{ {
ObjectHideMessage msg = new ObjectHideMessage {netId = identity.netId}; ObjectHideMessage msg = new ObjectHideMessage
{
netId = identity.netId
};
conn.Send(msg); conn.Send(msg);
} }
@ -1321,7 +1324,10 @@ static void DestroyObject(NetworkIdentity identity, DestroyMode mode)
identity.connectionToClient?.RemoveOwnedObject(identity); identity.connectionToClient?.RemoveOwnedObject(identity);
// send object destroy message to all observers, clear observers // send object destroy message to all observers, clear observers
SendToObservers(identity, new ObjectDestroyMessage {netId = identity.netId}); SendToObservers(identity, new ObjectDestroyMessage
{
netId = identity.netId
});
identity.ClearObservers(); identity.ClearObservers();
// in host mode, call OnStopClient/OnStopLocalPlayer manually // in host mode, call OnStopClient/OnStopLocalPlayer manually

View File

@ -10,7 +10,7 @@ public override void OnServerDisconnect(NetworkConnectionToClient conn)
base.OnServerDisconnect(conn); base.OnServerDisconnect(conn);
++called; ++called;
} }
} }
[TestFixture] [TestFixture]
public class NetworkManagerStopHostOnServerDisconnectTest : MirrorEditModeTest public class NetworkManagerStopHostOnServerDisconnectTest : MirrorEditModeTest