mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkScene.SetLocalObject simplified
This commit is contained in:
parent
64c120fe5e
commit
a848c36d6e
@ -22,18 +22,21 @@ internal void SetLocalObject(uint netId, NetworkIdentity ni, bool isClient, bool
|
||||
{
|
||||
if (LogFilter.Debug) { Debug.Log("SetLocalObject " + netId + " " + ni); }
|
||||
|
||||
if (ni == null)
|
||||
if (ni != null)
|
||||
{
|
||||
NetworkIdentity.spawned[netId] = null;
|
||||
return;
|
||||
}
|
||||
ni.UpdateClientServer(isClient, isServer);
|
||||
|
||||
// !Contains check needed to avoid dictionary 'out of sync' error
|
||||
// because SetLocalObject is called from a foreach loop
|
||||
if (!NetworkIdentity.spawned.ContainsKey(netId))
|
||||
{
|
||||
NetworkIdentity.spawned[netId] = ni;
|
||||
}
|
||||
|
||||
ni.UpdateClientServer(isClient, isServer);
|
||||
}
|
||||
else
|
||||
{
|
||||
NetworkIdentity.spawned[netId] = null;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void RegisterPrefab(GameObject prefab, Guid newAssetId)
|
||||
|
Loading…
Reference in New Issue
Block a user