mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
InterestManagement: NetworkIdentity.forceHidden added again to replace NetworkProximityChecker.forceHidden
This commit is contained in:
parent
a9b0254fcc
commit
b9c0ee144b
@ -31,6 +31,9 @@ void RebuildObservers()
|
||||
// clear previous rebuild first
|
||||
identity.rebuild.Clear();
|
||||
|
||||
// only add observers if not currently hidden from observers
|
||||
if (!identity.forceHidden)
|
||||
{
|
||||
// check distance with each player connection
|
||||
// TODO check with each player connection's owned entities
|
||||
// (a monster is visible to a player, if either the player or
|
||||
@ -48,6 +51,7 @@ void RebuildObservers()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if (identity.rebuild.Count > 0)
|
||||
// Debug.Log($"{identity.name} is observed by {identity.rebuild.Count} connections");
|
||||
|
@ -165,6 +165,13 @@ public sealed class NetworkIdentity : MonoBehaviour
|
||||
internal HashSet<NetworkConnectionToClient> rebuild = new HashSet<NetworkConnectionToClient>();
|
||||
public HashSet<NetworkConnectionToClient> observers = new HashSet<NetworkConnectionToClient>();
|
||||
|
||||
// Enable to temporarily hide from players. For example, to hide a
|
||||
// monster while it's respawning. This way the monster still exists,
|
||||
// still gets updated, but is hidden from players. This is more
|
||||
// convenient than removing the monster completely and respawning it
|
||||
// with a Spawner.
|
||||
[HideInInspector] public bool forceHidden;
|
||||
|
||||
/// <summary>
|
||||
/// Unique identifier for this particular object instance, used for tracking objects between networked clients and the server.
|
||||
/// <para>This is a unique identifier for this particular GameObject instance. Use it to track GameObjects between networked clients and the server.</para>
|
||||
|
Loading…
Reference in New Issue
Block a user