fix: NetworkIdentity.Reset resets isLocalPlayer AFTER the isLocalPlayer ClearLocalPlayer check. fixes a runtime UnSpawn test.

This commit is contained in:
vis2k 2021-03-10 23:45:29 +08:00
parent a23c01aa24
commit accf843283

View File

@ -1110,7 +1110,7 @@ internal void Reset()
clientStarted = false; clientStarted = false;
isClient = false; isClient = false;
isServer = false; isServer = false;
isLocalPlayer = false; //isLocalPlayer = false; <- cleared AFTER ClearLocalPlayer below!
netId = 0; netId = 0;
connectionToServer = null; connectionToServer = null;
@ -1119,10 +1119,13 @@ internal void Reset()
ClearObservers(); ClearObservers();
// clear local player if it was the local player,
// THEN reset isLocalPlayer AFTERWARDS
if (isLocalPlayer) if (isLocalPlayer)
{ {
NetworkClient.ClearLocalPlayer(); NetworkClient.ClearLocalPlayer();
} }
isLocalPlayer = false;
} }
// clear all component's dirty bits no matter what // clear all component's dirty bits no matter what