mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
explain the special case in RebuildObservers
This commit is contained in:
parent
e0d276e86b
commit
ba88ca6ab5
@ -1021,7 +1021,22 @@ public void RebuildObservers(bool initialize)
|
||||
}
|
||||
}
|
||||
|
||||
// special case for host mode client.
|
||||
// special case for host mode: we use SetHostVisibility to hide
|
||||
// NetworkIdentities that aren't in observer range from host.
|
||||
// this is what games like Dota/Counter-Strike do too, where a host
|
||||
// does NOT see all players by default. they are in memory, but
|
||||
// hidden to the host player.
|
||||
//
|
||||
// this code is from UNET, it's a bit strange but it works:
|
||||
// * it hides newly connected identities in host mode
|
||||
// => that part was the intended behaviour
|
||||
// * it hides ALL NetworkIdentities in host mode when the host
|
||||
// connects but hasn't selected a character yet
|
||||
// * it hides ALL NetworkIdentities in server-only mode because
|
||||
// observers never contain the 'null' .localConnection
|
||||
// => that was not intended, but let's keep it as it is so we
|
||||
// don't break anything in host mode. it's way easier than
|
||||
// iterating all identities in a special function in StartHost.
|
||||
if (initialize)
|
||||
{
|
||||
if (!newObservers.Contains(NetworkServer.localConnection))
|
||||
|
Loading…
Reference in New Issue
Block a user