Table of Contents

Class NetworkBehaviour

Namespace
Netick
Assembly
Netick.dll

Network Behaviour is the base class for all behaviours that need to be networked.

public abstract class NetworkBehaviour : NetickBehaviour
Inheritance
Object
Component
Behaviour
MonoBehaviour
NetworkBehaviour
Derived
Inherited Members
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.useGUILayout
MonoBehaviour.runInEditMode
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.GetComponent<T>()
Component.TryGetComponent<T>(out T)
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren<T>()
Component.GetComponentInParent<T>()
Component.GetComponentsInParent<T>()
Component.GetComponents<T>()
Component.transform
Component.gameObject
Component.tag
Object.GetInstanceID()
Object.GetHashCode()
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectOfType<T>()
Object.ToString()
Object.name
Object.hideFlags
Extension Methods

Constructors

NetworkBehaviour()

protected NetworkBehaviour()

Properties

BehaviourId

[NetworkedGroup(NetGroup.End, Relevancy.Everyone, false)]
public int BehaviourId { get; }

Property Value

int

Id

The network id of this object.

public int Id { get; }

Property Value

int

InputSource

Returns the source NetworkPlayer (NetworkPeer/ServerConnection) of inputs for this NetworkObject. If the source of inputs is remote (from a client) it returns that ServerConnection, while on the input source itself it returns the local NetworkPlayer.

public NetworkPlayer InputSource { get; }

Property Value

NetworkPlayer

IsClient

Returns true if this Sandbox is a client.

public bool IsClient { get; }

Property Value

bool

IsInputSource

Returns true if this LocalPlayer is providing inputs to this Object.

public bool IsInputSource { get; }

Property Value

bool

IsOwner

Returns true if this Sandbox is the owner of this Object. In this version of Netick: Server=Owner.

public bool IsOwner { get; }

Property Value

bool

IsProxy

Returns true if we neither provide inputs nor own this object.

public bool IsProxy { get; }

Property Value

bool

IsResimulating

Returns true if we are currently resimulating a previous input of the past. On the server, it always returns false since only the clients resimulate.

public bool IsResimulating { get; }

Property Value

bool

IsServer

Returns true if this Sandbox is the server.

public bool IsServer { get; }

Property Value

bool

Methods

AddArray(nArray)

Internal method. Never call this.

public void AddArray(nArray array)

Parameters

array nArray

AddProperty(NetworkVariable, bool, bool)

Internal method. Never call this.

public NetworkVariable AddProperty(NetworkVariable property, bool isInterpolated, bool isPredicted)

Parameters

property NetworkVariable
isInterpolated bool
isPredicted bool

Returns

NetworkVariable

ApplyToBehaviour()

Overrides this to apply the Unity's component (or third-party component) state into the network state (network properties) of this NetworkBehaviour.

public virtual void ApplyToBehaviour()

ApplyToComponent()

Overrides this to apply the network state (network properties) of this NetworkBehaviour into the Unity's component (or third-party component) state.

public virtual void ApplyToComponent()

BeforeSetup()

public virtual void BeforeSetup()

CanInvoke(RpcPeers, RpcPeers, bool, int)

Internal method. Never call this.

public bool CanInvoke(RpcPeers source, RpcPeers target, bool localInvoke, int rpcId)

Parameters

source RpcPeers
target RpcPeers
localInvoke bool
rpcId int

Returns

bool

CanSend(RpcPeers, RpcPeers, int)

Internal method. Never call this.

public bool CanSend(RpcPeers source, RpcPeers target, int id)

Parameters

source RpcPeers
target RpcPeers
id int

Returns

bool

FetchInput<T>(out T)

Fetchs a NetworkInput for this tick. Returns false if no input source is currently providing inputs to this Object, or when input loss occurs (in case of a remote input source).

public bool FetchInput<T>(out T input) where T : NetworkInput

Parameters

input T

Returns

bool

Type Parameters

T

FetchInput<T>(out T, out Tick, out float)

Fetchs a NetworkInput for this tick. Returns false if no input source is currently providing inputs to this Object, or when input loss occurs (in case of a remote input source).

public bool FetchInput<T>(out T input, out Tick interpolationTick, out float interpolationAlpha) where T : NetworkInput

Parameters

input T
interpolationTick Tick
interpolationAlpha float

Returns

bool

Type Parameters

T

FindInterpolator<T>(int)

Finds a property interpolator by Id. You should call this in NetworkStart, and store your interpolator in a variable - because calling this repeatedly is slow.

public Interpolator<T> FindInterpolator<T>(int id) where T : struct

Parameters

id int

Interpolator id

Returns

Interpolator<T>

Interpolator of the property

Type Parameters

T

Property type

InitProperties()

Internal method. Never call this.

public virtual void InitProperties()

NetworkInit()

public virtual void NetworkInit()

NetworkReset()

Called when this Object (which's part of a networked prefab) has been recycled. It's used to reset the state of networked prefabs for reuse later. Make sure to reset the object correctly.

Note: all network properties are auto-reset to their declaration value by Netick. Therefore, you only need to reset non-networked fields which need to be reset.

Note: this is only called if pooling is activated for this prefab.

public virtual void NetworkReset()

OnInputPermitted()

Called when this LocalPlayer has been granted permission to provide inputs to this Object.

public virtual void OnInputPermitted()

OnInputRevoked()

Called when this LocalPlayer has been revoked from providing inputs to this Object.

public virtual void OnInputRevoked()

OnInputSourceLeft()

Called on the server when the input source of this Object has disconnected.

public virtual void OnInputSourceLeft()

OnSpawnPredictionSucceeded()

Called on the client when the server confirms that this object has been successfully spawn-predicted and therefore has a valid Id.

public virtual void OnSpawnPredictionSucceeded()