docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class NetworkProximityChecker

    Component that controls visibility of networked objects for players.

    Any object with this component on it will not be visible to players more than a (configurable) distance away.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    NetworkBehaviour
    NetworkProximityChecker
    Inherited Members
    NetworkBehaviour.localPlayerAuthority
    NetworkBehaviour.isServer
    NetworkBehaviour.isClient
    NetworkBehaviour.isLocalPlayer
    NetworkBehaviour.hasAuthority
    NetworkBehaviour.netId
    NetworkBehaviour.connectionToServer
    NetworkBehaviour.connectionToClient
    NetworkBehaviour.playerControllerId
    NetworkBehaviour.syncVarDirtyBits
    NetworkBehaviour.syncVarHookGuard
    NetworkBehaviour.SetDirtyBit(uint)
    NetworkBehaviour.ClearAllDirtyBits()
    NetworkBehaviour.OnSerialize(NetworkWriter, bool)
    NetworkBehaviour.OnDeserialize(NetworkReader, bool)
    NetworkBehaviour.OnNetworkDestroy()
    NetworkBehaviour.OnStartServer()
    NetworkBehaviour.OnStartClient()
    NetworkBehaviour.OnStartLocalPlayer()
    NetworkBehaviour.OnStartAuthority()
    NetworkBehaviour.OnStopAuthority()
    NetworkBehaviour.GetNetworkChannel()
    NetworkBehaviour.GetNetworkSendInterval()
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(string, float)
    MonoBehaviour.InvokeRepeating(string, float, float)
    MonoBehaviour.CancelInvoke(string)
    MonoBehaviour.IsInvoking(string)
    MonoBehaviour.StartCoroutine(string)
    MonoBehaviour.StartCoroutine(string, object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(string)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, out Component)
    Component.TryGetComponent<T>(out T)
    Component.GetComponent(string)
    Component.GetComponentInChildren(Type, bool)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(bool)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, bool)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(bool)
    Component.GetComponentsInChildren<T>(bool, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, bool)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(bool)
    Component.GetComponentsInParent<T>(bool, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(string)
    Component.SendMessageUpwards(string, object, SendMessageOptions)
    Component.SendMessageUpwards(string, object)
    Component.SendMessageUpwards(string)
    Component.SendMessageUpwards(string, SendMessageOptions)
    Component.SendMessage(string, object)
    Component.SendMessage(string)
    Component.SendMessage(string, object, SendMessageOptions)
    Component.SendMessage(string, SendMessageOptions)
    Component.BroadcastMessage(string, object, SendMessageOptions)
    Component.BroadcastMessage(string, object)
    Component.BroadcastMessage(string)
    Component.BroadcastMessage(string, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectOfType<T>()
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.ToString()
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.Networking
    Assembly: com.unity.multiplayer-hlapi.Runtime.dll
    Syntax
    [AddComponentMenu("Network/NetworkProximityChecker")]
    [RequireComponent(typeof(NetworkIdentity))]
    [Obsolete("The high level API classes are deprecated and will be removed in the future.")]
    public class NetworkProximityChecker : NetworkBehaviour

    Fields

    checkMethod

    Which method to use for checking proximity of players.

    Declaration
    [Tooltip("Which method to use for checking proximity of players.\n\nPhysics3D uses 3D physics to determine proximity.\n\nPhysics2D uses 2D physics to determine proximity.")]
    public NetworkProximityChecker.CheckMethod checkMethod
    Field Value
    Type Description
    NetworkProximityChecker.CheckMethod

    forceHidden

    Flag to force this object to be hidden for players.

    If this object is a player object, it will not be hidden for that player.

    Declaration
    [Tooltip("Enable to force this object to be hidden from players.")]
    public bool forceHidden
    Field Value
    Type Description
    bool

    visRange

    The maximim range that objects will be visible at.

    Declaration
    [Tooltip("The maximum range that objects will be visible at.")]
    public int visRange
    Field Value
    Type Description
    int

    visUpdateInterval

    How often (in seconds) that this object should update the set of players that can see it.

    Declaration
    [Tooltip("How often (in seconds) that this object should update the set of players that can see it.")]
    public float visUpdateInterval
    Field Value
    Type Description
    float

    Methods

    OnCheckObserver(NetworkConnection)

    Callback used by the visibility system to determine if an observer (player) can see this object.

    If this function returns true, the network connection will be added as an observer.

    Declaration
    public override bool OnCheckObserver(NetworkConnection newObserver)
    Parameters
    Type Name Description
    NetworkConnection newObserver
    Returns
    Type Description
    bool

    True if the player can see this object.

    Overrides
    NetworkBehaviour.OnCheckObserver(NetworkConnection)

    OnRebuildObservers(HashSet<NetworkConnection>, bool)

    Callback used by the visibility system to (re)construct the set of observers that can see this object.

    Implementations of this callback should add network connections of players that can see this object to the observers set.

    Declaration
    public override bool OnRebuildObservers(HashSet<NetworkConnection> observers, bool initial)
    Parameters
    Type Name Description
    HashSet<NetworkConnection> observers

    The new set of observers for this object.

    bool initial
    Returns
    Type Description
    bool

    Return true if this function did work.

    Overrides
    NetworkBehaviour.OnRebuildObservers(HashSet<NetworkConnection>, bool)

    OnSetLocalVisibility(bool)

    Callback used by the visibility system for objects on a host.

    Objects on a host (with a local client) cannot be disabled or destroyed when they are not visibile to the local client. So this function is called to allow custom code to hide these objects. A typical implementation will disable renderer components on the object. This is only called on local clients on a host.

    Declaration
    public override void OnSetLocalVisibility(bool vis)
    Parameters
    Type Name Description
    bool vis

    New visibility state.

    Overrides
    NetworkBehaviour.OnSetLocalVisibility(bool)
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)