Class NetworkBehaviour
The base class to override to write network code. Inherits MonoBehaviour
Inherited Members
Namespace: Unity.Netcode
Assembly: solution.dll
Syntax
public abstract class NetworkBehaviour : MonoBehaviour
Properties
Name | Description |
---|---|
Has |
Gets whether or not this NetworkBehaviour instance has a NetworkObject owner. |
Is |
Gets if we are executing as client |
Is |
Gets if we are executing as Host, I.E Server and Client |
Is |
If a NetworkObject is assigned, it will return whether or not this NetworkObject is the local player object. If no NetworkObject is assigned it will always return false. |
Is |
Gets Whether or not the object has a owner |
Is |
Gets if the object is owned by the local player or if the object is the local player object |
Is |
Gets if we are executing as server |
Is |
Used to determine if it is safe to access NetworkObject and NetworkManager from within a NetworkBehaviour component Primarily useful when checking NetworkObject/NetworkManager properties within FixedUpate |
Network |
Gets NetworkId for this NetworkBehaviour from the owner NetworkObject |
Network |
Gets the NetworkManager that owns this NetworkBehaviour instance
See note around |
Network |
Gets the NetworkObject that owns this NetworkBehaviour instance |
Network |
Gets the NetworkId of the NetworkObject that owns this NetworkBehaviour |
Owner |
Gets the ClientId that owns the NetworkObject |
m_Target |
The relative client identifier targeted for the serialization of this Network |
Methods
Name | Description |
---|---|
Get |
Returns a the NetworkBehaviour with a given BehaviourId for the current NetworkObject |
Get |
Gets the local instance of a object with a given NetworkId |
On |
Invoked when the Game |
On |
Gets called when the local client gains ownership of this object |
On |
Gets called when we loose ownership of this object |
On |
Gets called when the Network |
On |
Gets called when the parent NetworkObject of this NetworkBehaviour's NetworkObject has changed |
On |
Gets called when the Network |
On |
Invoked on all clients, override this method to be notified of any ownership changes (even if the instance was niether the previous or newly assigned current owner). |
On |
Override this method if your derived NetworkBehaviour requires custom synchronization data.
Note: Use of this method is only for the initial client synchronization of NetworkBehaviours
and will increase the payload size for client synchronization and dynamically spawned
Network |