mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
NetworkIdentity.RebuildObservers: put conn null/ready checks into one line
This commit is contained in:
parent
4ba456439a
commit
0f110eb4b7
@ -1049,21 +1049,16 @@ public void RebuildObservers(bool initialize)
|
||||
// add all newObservers that aren't in .observers yet
|
||||
foreach (NetworkConnection conn in newObservers)
|
||||
{
|
||||
if (conn != null)
|
||||
// only add ready connections.
|
||||
// otherwise the player might not be in the world yet or anymore
|
||||
if (conn != null && conn.isReady)
|
||||
{
|
||||
if (conn.isReady)
|
||||
if (initialize || !observers.ContainsKey(conn.connectionId))
|
||||
{
|
||||
if (initialize || !observers.ContainsKey(conn.connectionId))
|
||||
{
|
||||
// new observer
|
||||
conn.AddToVisList(this);
|
||||
if (LogFilter.Debug) Debug.Log("New Observer for " + gameObject + " " + conn);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LogFilter.Debug) Debug.Log("Observer is not ready for " + gameObject + " " + conn);
|
||||
// new observer
|
||||
conn.AddToVisList(this);
|
||||
if (LogFilter.Debug) Debug.Log("New Observer for " + gameObject + " " + conn);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user