• Api Documentation
  • Manual
Show / Hide Table of Contents
  • FishNet
    • InstanceFinder
  • FishNet.Authenticating
    • Authenticator
  • FishNet.Broadcast
    • IBroadcast
  • FishNet.Broadcast.Helping
    • BroadcastHandlerBase
  • FishNet.CodeGenerating
    • AllowMutableSyncTypeAttribute
    • CustomComparerAttribute
    • DefaultDeltaReaderAttribute
    • DefaultDeltaWriterAttribute
    • DefaultReaderAttribute
    • DefaultWriterAttribute
    • ExcludeSerializationAttribute
    • IncludeSerializationAttribute
    • NotSerializerAttribute
    • ReadUnallocatedAttribute
    • UseGlobalCustomSerializerAttribute
  • FishNet.Component.Animating
    • NetworkAnimator
  • FishNet.Component.ColliderRollback
    • ColliderRollback
    • RollbackManager
    • RollbackPhysicsType
  • FishNet.Component.Observing
    • DistanceCondition
    • GridCondition
    • GridEntry
    • HashGrid
    • HashGrid.GridAxes
    • HostOnlyCondition
    • MatchCondition
    • MatchCondition.ConditionCollections
    • OwnerOnlyCondition
    • SceneCondition
  • FishNet.Component.Ownership
    • PredictedOwner
    • PredictedSpawn
  • FishNet.Component.Prediction
    • NetworkCollider
    • NetworkCollider2D
    • NetworkCollision
    • NetworkCollision2D
    • NetworkTrigger
    • NetworkTrigger2D
    • OfflineRigidbody
    • Rigidbody2DState
    • RigidbodyPauser
    • RigidbodyState
    • RigidbodyStateExtensions
    • RigidbodyStateSerializers
    • RigidbodyType
  • FishNet.Component.Scenes
    • DefaultScene
  • FishNet.Component.Spawning
    • PlayerSpawner
  • FishNet.Component.Transforming
    • DetachableNetworkTickSmoother
    • MonoTickSmoother
    • NetworkTickSmoother
    • NetworkTransform
    • NetworkTransform.ComponentConfigurationType
    • NetworkTransform.GoalData
    • NetworkTransform.RateData
    • NetworkTransform.SnappedAxes
    • NetworkTransform.TransformData
    • NetworkTransform.TransformData.ExtrapolateState
    • SynchronizedProperty
  • FishNet.Component.Utility
    • BandwidthDisplay
    • PingDisplay
  • FishNet.Connection
    • NetworkConnection
    • NetworkConnectionExtensions
  • FishNet.Managing
    • NetworkManager
    • NetworkManager.HostIterationOrder
    • NetworkManager.PersistenceType
    • NetworkManagerExtensions
    • RemoteTimeoutType
  • FishNet.Managing.Client
    • ClientManager
    • ClientObjects
  • FishNet.Managing.Debugging
    • DebugManager
  • FishNet.Managing.Logging
    • LevelLoggingConfiguration
    • LoggingConfiguration
    • LoggingType
  • FishNet.Managing.Object
    • DualPrefab
    • ManagedObjects
  • FishNet.Managing.Observing
    • ObserverManager
  • FishNet.Managing.Predicting
    • PredictionManager
    • PredictionManager.PostPhysicsSyncTransformDel
    • PredictionManager.PostReconcileDel
    • PredictionManager.PostReplicateReplayDel
    • PredictionManager.PrePhysicsSyncTransformDel
    • PredictionManager.PreReconcileDel
    • PredictionManager.PreReplicateReplayDel
    • PredictionManager.ReconcileDel
    • PredictionManager.ReplicateReplayDel
    • ReplicateStateOrder
  • FishNet.Managing.Scened
    • ClientPresenceChangeEventArgs
    • DefaultSceneProcessor
    • EmptyStartScenesBroadcast
    • LoadOptions
    • LoadParams
    • LoadQueueData
    • PreferredScene
    • ReplaceOption
    • SceneLoadData
    • SceneLoadEndEventArgs
    • SceneLoadPercentEventArgs
    • SceneLoadStartEventArgs
    • SceneLookupData
    • SceneManager
    • SceneProcessorBase
    • SceneScopeType
    • SceneUnloadData
    • SceneUnloadEndEventArgs
    • SceneUnloadStartEventArgs
    • UnloadedScene
    • UnloadOptions
    • UnloadOptions.ServerUnloadMode
    • UnloadParams
    • UnloadQueueData
  • FishNet.Managing.Server
    • ClientConnectionChangeBroadcast
    • ConnectedClientsBroadcast
    • KickReason
    • ServerManager
    • ServerObjects
  • FishNet.Managing.Statistic
    • NetworkTrafficArgs
    • NetworkTraficStatistics
    • StatisticsManager
  • FishNet.Managing.Timing
    • EstimatedTick
    • EstimatedTick.OldTickOption
    • PhysicsMode
    • PreciseTick
    • PreciseTickExtensions
    • PreciseTickSerializer
    • TickRounding
    • TickType
    • TimeManager
  • FishNet.Managing.Transporting
    • IntermediateLayer
    • LatencySimulator
    • TransportManager
  • FishNet.Managing.Utility
    • Packets
  • FishNet.Object
    • ClientAttribute
    • DataOrderType
    • DespawnType
    • EmptyNetworkBehaviour
    • GlobalPreserveOwnedObjects
    • NetworkBehaviour
    • NetworkObject
    • NetworkObject.HostVisibilityUpdatedDelegate
    • NetworkObjectIdComparer
    • NetworkPreserveOwnedObjects
    • ObserversRpcAttribute
    • ReplicateState
    • ReplicateStateExtensions
    • RpcAttribute
    • ServerAttribute
    • ServerRpcAttribute
    • TargetRpcAttribute
    • TransformProperties
    • TransformPropertiesCls
    • TransformPropertiesFlag
    • TransformPropertiesOptionExtensions
  • FishNet.Object.Prediction
    • AdaptiveInterpolationType
    • ChildTransformTickSmoother
    • IReconcileData
    • IReplicateData
    • PredictionigidbodySerializers
    • PredictionRigidbody
    • PredictionRigidbody.AllForceData
    • PredictionRigidbody.EntryData
    • PredictionRigidbody.ForceApplicationType
    • PredictionRigidbody.IForceData
    • PredictionRigidbody2D
    • PredictionRigidbody2D.AllForceData
    • PredictionRigidbody2D.EntryData
    • PredictionRigidbody2D.ForceApplicationType
    • PredictionRigidbody2D2DSerializers
    • ReconcileAttribute
    • ReplicateAttribute
  • FishNet.Object.Synchronizing
    • ByteSyncVar
    • DoubleSyncVar
    • FloatSyncVar
    • ICustomSync
    • IntSyncVar
    • LongSyncVar
    • ReadPermission
    • SbyteSyncVar
    • ShortSyncVar
    • SyncDictionary<TKey, TValue>
    • SyncHashSet<T>
    • SyncList<T>
    • SyncObjectAttribute
    • SyncStopwatch
    • SyncStopwatch.SyncTypeChanged
    • SyncStopwatchOperation
    • SyncTimer
    • SyncTimer.SyncTypeChanged
    • SyncTimerOperation
    • SyncTypeSettings
    • SyncVarAttribute
    • UIntSyncVar
    • ULongSyncVar
    • UShortSyncVar
    • Vector2IntSyncVar
    • Vector2SyncVar
    • Vector3IntSyncVar
    • Vector3SyncVar
    • Vector4SyncVar
    • WritePermission
  • FishNet.Observing
    • HostVisibilityUpdateTypes
    • NetworkObserver
    • NetworkObserver.ConditionOverrideType
    • ObserverCondition
    • ObserverConditionType
  • FishNet.Serializing
    • AutoPackType
    • DeltaSerializerOption
    • DeltaSerializerOptionExtensions
    • PooledReader
    • PooledWriter
    • Reader
    • Reader.DataSource
    • ReaderPool
    • SubStream
    • Writer
    • WriterPool
  • FishNet.Transporting
    • Channel
    • ClientConnectionStateArgs
    • ClientReceivedDataArgs
    • ConnectedClientsArgs
    • IPAddressType
    • LocalConnectionState
    • RemoteConnectionState
    • RemoteConnectionStateArgs
    • ServerConnectionStateArgs
    • ServerReceivedDataArgs
    • Transport
    • TransportConsts
  • GameKit.Dependencies.Utilities
    • ApplicationState
    • Arrays
    • BasicQueue<T>
    • Booleans
    • Bytes
    • CanvaseGroups
    • CanvasGroupBlockingType
    • CollectionCaches<T>
    • CollectionCaches<T1, T2>
    • Collider2DExtensions
    • ColliderExtensions
    • DictionaryFN
    • Disks
    • Enums
    • Floats
    • Hashing
    • Ints
    • IOs
    • IResettable
    • IWeighted
    • Layers
    • LayoutGroups
    • Materials
    • Maths
    • ObjectCaches<T>
    • Objects
    • Particles
    • PointerMonoBehaviour
    • Quaternions
    • ResettableCollectionCaches<T>
    • ResettableCollectionCaches<T1, T2>
    • ResettableObjectCaches<T>
    • ResettableT1CollectionCaches<T1, T2>
    • ResettableT2CollectionCaches<T1, T2>
    • Strings
    • Transforms
    • UInts
    • Vectors
    • WeightedRandom
  • GameKit.Dependencies.Utilities.ObjectPooling
    • ListStack<GameObject>
    • ObjectPool
    • PoolData
  • GameKit.Dependencies.Utilities.ObjectPooling.Examples
    • Projectile
    • ProjectileSpawner
  • GameKit.Dependencies.Utilities.Types
    • ByteRange
    • CanvasGroupFader
    • CanvasGroupFader.FadeGoalType
    • CanvasTracker
    • DDOL
    • FloatRange
    • FloatRange2D
    • IntRange
    • IOrderable
    • RectTransformResizer
    • RectTransformResizer.ResizeData
    • RectTransformResizer.ResizeDelegate
    • ResettableRingBuffer<T>
    • ResettableRingBuffer<T>.Enumerator
    • RingBuffer<T>
    • RingBuffer<T>.Enumerator
    • SceneAttribute
    • ScrollbarValueSetter
    • SingletonScriptableObject<T>
    • SmoothCameraTarget
    • TimedOperation
    • UIntRange
    • Vector2Range
  • GameKit.Dependencies.Utilities.Types.CanvasContainers
    • ButtonData
    • ButtonData.PressedDelegate
    • FloatingContainer
    • FloatingImage
    • ImageButtonData
    • ResizableContainer
  • GameKit.Dependencies.Utilities.Types.OptionMenuButtons
    • FloatingOptions

Class NetworkBehaviour

Scripts which inherit from NetworkBehaviour can be used to gain insight of, and perform actions on the network.

Inheritance
System.Object
UnityEngine.Object
UnityEngine.Component
UnityEngine.Behaviour
UnityEngine.MonoBehaviour
NetworkBehaviour
NetworkAnimator
ColliderRollback
PredictedOwner
PredictedSpawn
NetworkCollider
NetworkCollider2D
DetachableNetworkTickSmoother
NetworkTickSmoother
NetworkTransform
EmptyNetworkBehaviour
NetworkPreserveOwnedObjects
Inherited Members
UnityEngine.MonoBehaviour.IsInvoking()
UnityEngine.MonoBehaviour.CancelInvoke()
UnityEngine.MonoBehaviour.Invoke(System.String, System.Single)
UnityEngine.MonoBehaviour.InvokeRepeating(System.String, System.Single, System.Single)
UnityEngine.MonoBehaviour.CancelInvoke(System.String)
UnityEngine.MonoBehaviour.IsInvoking(System.String)
UnityEngine.MonoBehaviour.StartCoroutine(System.String)
UnityEngine.MonoBehaviour.StartCoroutine(System.String, System.Object)
UnityEngine.MonoBehaviour.StartCoroutine(System.Collections.IEnumerator)
UnityEngine.MonoBehaviour.StartCoroutine_Auto(System.Collections.IEnumerator)
UnityEngine.MonoBehaviour.StopCoroutine(System.Collections.IEnumerator)
UnityEngine.MonoBehaviour.StopCoroutine(UnityEngine.Coroutine)
UnityEngine.MonoBehaviour.StopCoroutine(System.String)
UnityEngine.MonoBehaviour.StopAllCoroutines()
UnityEngine.MonoBehaviour.print(System.Object)
UnityEngine.MonoBehaviour.useGUILayout
UnityEngine.MonoBehaviour.runInEditMode
UnityEngine.Behaviour.enabled
UnityEngine.Behaviour.isActiveAndEnabled
UnityEngine.Component.GetComponent(System.Type)
UnityEngine.Component.GetComponent<T>()
UnityEngine.Component.TryGetComponent(System.Type, UnityEngine.Component)
UnityEngine.Component.TryGetComponent<T>(T)
UnityEngine.Component.GetComponent(System.String)
UnityEngine.Component.GetComponentInChildren(System.Type, System.Boolean)
UnityEngine.Component.GetComponentInChildren(System.Type)
UnityEngine.Component.GetComponentInChildren<T>(System.Boolean)
UnityEngine.Component.GetComponentInChildren<T>()
UnityEngine.Component.GetComponentsInChildren(System.Type, System.Boolean)
UnityEngine.Component.GetComponentsInChildren(System.Type)
UnityEngine.Component.GetComponentsInChildren<T>(System.Boolean)
UnityEngine.Component.GetComponentsInChildren<T>(System.Boolean, System.Collections.Generic.List<T>)
UnityEngine.Component.GetComponentsInChildren<T>()
UnityEngine.Component.GetComponentsInChildren<T>(System.Collections.Generic.List<T>)
UnityEngine.Component.GetComponentInParent(System.Type, System.Boolean)
UnityEngine.Component.GetComponentInParent(System.Type)
UnityEngine.Component.GetComponentInParent<T>(System.Boolean)
UnityEngine.Component.GetComponentInParent<T>()
UnityEngine.Component.GetComponentsInParent(System.Type, System.Boolean)
UnityEngine.Component.GetComponentsInParent(System.Type)
UnityEngine.Component.GetComponentsInParent<T>(System.Boolean)
UnityEngine.Component.GetComponentsInParent<T>(System.Boolean, System.Collections.Generic.List<T>)
UnityEngine.Component.GetComponentsInParent<T>()
UnityEngine.Component.GetComponents(System.Type)
UnityEngine.Component.GetComponents(System.Type, System.Collections.Generic.List<UnityEngine.Component>)
UnityEngine.Component.GetComponents<T>(System.Collections.Generic.List<T>)
UnityEngine.Component.GetComponents<T>()
UnityEngine.Component.CompareTag(System.String)
UnityEngine.Component.SendMessageUpwards(System.String, System.Object, UnityEngine.SendMessageOptions)
UnityEngine.Component.SendMessageUpwards(System.String, System.Object)
UnityEngine.Component.SendMessageUpwards(System.String)
UnityEngine.Component.SendMessageUpwards(System.String, UnityEngine.SendMessageOptions)
UnityEngine.Component.SendMessage(System.String, System.Object)
UnityEngine.Component.SendMessage(System.String)
UnityEngine.Component.SendMessage(System.String, System.Object, UnityEngine.SendMessageOptions)
UnityEngine.Component.SendMessage(System.String, UnityEngine.SendMessageOptions)
UnityEngine.Component.BroadcastMessage(System.String, System.Object, UnityEngine.SendMessageOptions)
UnityEngine.Component.BroadcastMessage(System.String, System.Object)
UnityEngine.Component.BroadcastMessage(System.String)
UnityEngine.Component.BroadcastMessage(System.String, UnityEngine.SendMessageOptions)
UnityEngine.Component.transform
UnityEngine.Component.gameObject
UnityEngine.Component.tag
UnityEngine.Object.GetInstanceID()
UnityEngine.Object.GetHashCode()
UnityEngine.Object.Equals(System.Object)
UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Vector3, UnityEngine.Quaternion)
UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Vector3, UnityEngine.Quaternion, UnityEngine.Transform)
UnityEngine.Object.Instantiate(UnityEngine.Object)
UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Transform)
UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Transform, System.Boolean)
UnityEngine.Object.Instantiate<T>(T)
UnityEngine.Object.Instantiate<T>(T, UnityEngine.Vector3, UnityEngine.Quaternion)
UnityEngine.Object.Instantiate<T>(T, UnityEngine.Vector3, UnityEngine.Quaternion, UnityEngine.Transform)
UnityEngine.Object.Instantiate<T>(T, UnityEngine.Transform)
UnityEngine.Object.Instantiate<T>(T, UnityEngine.Transform, System.Boolean)
UnityEngine.Object.Destroy(UnityEngine.Object, System.Single)
UnityEngine.Object.Destroy(UnityEngine.Object)
UnityEngine.Object.DestroyImmediate(UnityEngine.Object, System.Boolean)
UnityEngine.Object.DestroyImmediate(UnityEngine.Object)
UnityEngine.Object.FindObjectsOfType(System.Type)
UnityEngine.Object.FindObjectsOfType(System.Type, System.Boolean)
UnityEngine.Object.FindObjectsByType(System.Type, UnityEngine.FindObjectsSortMode)
UnityEngine.Object.FindObjectsByType(System.Type, UnityEngine.FindObjectsInactive, UnityEngine.FindObjectsSortMode)
UnityEngine.Object.DontDestroyOnLoad(UnityEngine.Object)
UnityEngine.Object.DestroyObject(UnityEngine.Object, System.Single)
UnityEngine.Object.DestroyObject(UnityEngine.Object)
UnityEngine.Object.FindSceneObjectsOfType(System.Type)
UnityEngine.Object.FindObjectsOfTypeIncludingAssets(System.Type)
UnityEngine.Object.FindObjectsOfType<T>()
UnityEngine.Object.FindObjectsByType<T>(UnityEngine.FindObjectsSortMode)
UnityEngine.Object.FindObjectsOfType<T>(System.Boolean)
UnityEngine.Object.FindObjectsByType<T>(UnityEngine.FindObjectsInactive, UnityEngine.FindObjectsSortMode)
UnityEngine.Object.FindObjectOfType<T>()
UnityEngine.Object.FindObjectOfType<T>(System.Boolean)
UnityEngine.Object.FindFirstObjectByType<T>()
UnityEngine.Object.FindAnyObjectByType<T>()
UnityEngine.Object.FindFirstObjectByType<T>(UnityEngine.FindObjectsInactive)
UnityEngine.Object.FindAnyObjectByType<T>(UnityEngine.FindObjectsInactive)
UnityEngine.Object.FindObjectsOfTypeAll(System.Type)
UnityEngine.Object.FindObjectOfType(System.Type)
UnityEngine.Object.FindFirstObjectByType(System.Type)
UnityEngine.Object.FindAnyObjectByType(System.Type)
UnityEngine.Object.FindObjectOfType(System.Type, System.Boolean)
UnityEngine.Object.FindFirstObjectByType(System.Type, UnityEngine.FindObjectsInactive)
UnityEngine.Object.FindAnyObjectByType(System.Type, UnityEngine.FindObjectsInactive)
UnityEngine.Object.name
UnityEngine.Object.hideFlags
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: FishNet.Object
Assembly: FishNet.Runtime.dll
Syntax
public abstract class NetworkBehaviour : MonoBehaviour

Fields

MAXIMUM_NETWORKBEHAVIOURS

Maximum number of allowed added NetworkBehaviours.

Declaration
public const byte MAXIMUM_NETWORKBEHAVIOURS = 254
Field Value
Type Description
System.Byte

UNSET_NETWORKBEHAVIOUR_ID

Id for when a NetworkBehaviour is not valid.

Declaration
public const byte UNSET_NETWORKBEHAVIOUR_ID = 255
Field Value
Type Description
System.Byte

Properties

ClientManager

ClientManager for this object.

Declaration
public ClientManager ClientManager { get; }
Property Value
Type Description
ClientManager

ComponentIndex

ComponentIndex for this NetworkBehaviour.

Declaration
public byte ComponentIndex { get; }
Property Value
Type Description
System.Byte

HasAuthority

True if IsOwner, or if IsServerInitialized with no Owner.

Declaration
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "OnStartServer", "")]
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "OnStartNetwork", " Use (base.Owner.IsLocalClient || (base.IsServerInitialized && !Owner.Isvalid) instead.")]
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "Awake", "")]
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "Start", "")]
public bool HasAuthority { get; }
Property Value
Type Description
System.Boolean

IsBehaviourReconciling

True if this NetworkBehaviour is reconciling. If this NetworkBehaviour does not implemnent prediction methods this value will always be false. Value will be false if there is no data to reconcile to, even if the PredictionManager IsReconciling. Data may be missing if it were intentionally not sent, or due to packet loss.

Declaration
public bool IsBehaviourReconciling { get; }
Property Value
Type Description
System.Boolean

IsClient

Declaration
[Obsolete("Use IsClientInitialized. Note the difference between IsClientInitialized and IsClientStarted.")]
public bool IsClient { get; }
Property Value
Type Description
System.Boolean

IsClientInitialized

True if this object has been initialized on the client side. This is set true right before client start callbacks and after stop callbacks.

Declaration
public bool IsClientInitialized { get; }
Property Value
Type Description
System.Boolean

IsClientOnly

Declaration
[Obsolete("Use IsClientOnlyInitialized. Note the difference between IsClientOnlyInitialized and IsClientOnlyStarted.")]
public bool IsClientOnly { get; }
Property Value
Type Description
System.Boolean

IsClientOnlyInitialized

Declaration
public bool IsClientOnlyInitialized { get; }
Property Value
Type Description
System.Boolean

IsClientOnlyStarted

True if only the client is started and authenticated.

Declaration
public bool IsClientOnlyStarted { get; }
Property Value
Type Description
System.Boolean

IsClientStarted

True if the client is started and authenticated.

Declaration
public bool IsClientStarted { get; }
Property Value
Type Description
System.Boolean

IsDeinitializing

True if the NetworkObject for this NetworkBehaviour is deinitializing.

Declaration
public bool IsDeinitializing { get; }
Property Value
Type Description
System.Boolean

IsHost

Declaration
[Obsolete("Use IsHostInitialized. Note the difference between IsHostInitialized and IsHostStarted.")]
public bool IsHost { get; }
Property Value
Type Description
System.Boolean

IsHostInitialized

True if this object has been initialized on the server and client side.

Declaration
public bool IsHostInitialized { get; }
Property Value
Type Description
System.Boolean

IsHostStarted

True if client and server are started.

Declaration
public bool IsHostStarted { get; }
Property Value
Type Description
System.Boolean

IsManagerReconciling

True if a reconcile is occuring on the PredictionManager. Note the difference between this and IsBehaviourReconciling.

Declaration
public bool IsManagerReconciling { get; }
Property Value
Type Description
System.Boolean

IsNetworked

True if the object will always initialize as a networked object. When false the object will not automatically initialize over the network. Using Spawn() on an object will always set that instance as networked. To check if server or client has been initialized on this object use IsXYZInitialized.

Declaration
public bool IsNetworked { get; }
Property Value
Type Description
System.Boolean

IsOffline

True if client nor server are started.

Declaration
public bool IsOffline { get; }
Property Value
Type Description
System.Boolean

IsOwner

True if the local client is the owner of this object.

Declaration
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "OnStartServer", "")]
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "OnStartNetwork", " Use base.Owner.IsLocalClient instead.")]
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "Awake", "")]
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "Start", "")]
public bool IsOwner { get; }
Property Value
Type Description
System.Boolean

IsOwnerOrServer

Declaration
[Obsolete("Use HasAuthority")]
public bool IsOwnerOrServer { get; }
Property Value
Type Description
System.Boolean

IsServer

Declaration
[Obsolete("Use IsServerInitialized. Note the difference between IsServerInitialized and IsServerStarted.")]
public bool IsServer { get; }
Property Value
Type Description
System.Boolean

IsServerInitialized

True if this object has been initialized on the server side. This is set true right before server start callbacks and after stop callbacks.

Declaration
public bool IsServerInitialized { get; }
Property Value
Type Description
System.Boolean

IsServerOnly

Declaration
[Obsolete("Use IsServerOnlyInitialized. Note the difference between IsServerOnlyInitialized and IsServerOnlyStarted.")]
public bool IsServerOnly { get; }
Property Value
Type Description
System.Boolean

IsServerOnlyInitialized

Declaration
public bool IsServerOnlyInitialized { get; }
Property Value
Type Description
System.Boolean

IsServerOnlyStarted

True if only the server is started.

Declaration
public bool IsServerOnlyStarted { get; }
Property Value
Type Description
System.Boolean

IsServerStarted

True if server is started.

Declaration
public bool IsServerStarted { get; }
Property Value
Type Description
System.Boolean

IsSpawned

True if this NetworkBehaviour is initialized for the network.

Declaration
public bool IsSpawned { get; }
Property Value
Type Description
System.Boolean

LocalConnection

The local connection of the client calling this method.

Declaration
public NetworkConnection LocalConnection { get; }
Property Value
Type Description
NetworkConnection

NetworkManager

NetworkManager for this object.

Declaration
public NetworkManager NetworkManager { get; }
Property Value
Type Description
NetworkManager

NetworkObject

NetworkObject this behaviour is for.

Declaration
public NetworkObject NetworkObject { get; }
Property Value
Type Description
NetworkObject

NetworkObserver

NetworkObserver on this object.

Declaration
public NetworkObserver NetworkObserver { get; }
Property Value
Type Description
NetworkObserver

ObjectId

Unique Id for this _networkObjectCache. This does not represent the object owner.

Declaration
public int ObjectId { get; }
Property Value
Type Description
System.Int32

ObserverManager

ObserverManager for this object.

Declaration
public ObserverManager ObserverManager { get; }
Property Value
Type Description
ObserverManager

Observers

Observers for this NetworkBehaviour.

Declaration
public HashSet<NetworkConnection> Observers { get; }
Property Value
Type Description
System.Collections.Generic.HashSet<NetworkConnection>

Owner

Owner of this object.

Declaration
public NetworkConnection Owner { get; }
Property Value
Type Description
NetworkConnection

OwnerId

ClientId for this NetworkObject owner.

Declaration
public int OwnerId { get; }
Property Value
Type Description
System.Int32

PredictionManager

PredictionManager for this object.

Declaration
public PredictionManager PredictionManager { get; }
Property Value
Type Description
PredictionManager

RollbackManager

RollbackManager for this object.

Declaration
public RollbackManager RollbackManager { get; }
Property Value
Type Description
RollbackManager

SceneManager

SceneManager for this object.

Declaration
public SceneManager SceneManager { get; }
Property Value
Type Description
SceneManager

ServerManager

ServerManager for this object.

Declaration
public ServerManager ServerManager { get; }
Property Value
Type Description
ServerManager

TimeManager

TimeManager for this object.

Declaration
public TimeManager TimeManager { get; }
Property Value
Type Description
TimeManager

TransportManager

TransportManager for this object.

Declaration
public TransportManager TransportManager { get; }
Property Value
Type Description
TransportManager

Methods

CanLog(LoggingType)

True if can log for loggingType.

Declaration
public bool CanLog(LoggingType loggingType)
Parameters
Type Name Description
LoggingType loggingType

Type of logging being filtered.

Returns
Type Description
System.Boolean

ClearBuffedRpcs()

Clears all buffered RPCs for this NetworkBehaviour.

Declaration
public void ClearBuffedRpcs()

ClearReplicateCache()

Clears cached replicates for server and client. This can be useful to call on server and client after teleporting.

Declaration
public virtual void ClearReplicateCache()

CreateReconcile()

Override this method to create your reconcile data, and call your reconcile method.

Declaration
public virtual void CreateReconcile()

Despawn(NetworkObject, Nullable<DespawnType>)

Despawns a NetworkObject. Only call from the server.

Declaration
public void Despawn(NetworkObject nob, DespawnType? despawnType = null)
Parameters
Type Name Description
NetworkObject nob

NetworkObject to despawn.

System.Nullable<DespawnType> despawnType

What happens to the object after being despawned.

Despawn(Nullable<DespawnType>)

Despawns this _networkObjectCache. Can only be called on the server.

Declaration
public void Despawn(DespawnType? despawnType = null)
Parameters
Type Name Description
System.Nullable<DespawnType> despawnType

What happens to the object after being despawned.

Despawn(GameObject, Nullable<DespawnType>)

Despawns a GameObject. Only call from the server.

Declaration
public void Despawn(GameObject go, DespawnType? despawnType = null)
Parameters
Type Name Description
UnityEngine.GameObject go

GameObject to despawn.

System.Nullable<DespawnType> despawnType

What happens to the object after being despawned.

EmptyReplicatesQueueIntoHistory_Start()

This is overriden by codegen to call EmptyReplicatesQueueIntoHistory(). This should only be called when client only.

Declaration
protected virtual void EmptyReplicatesQueueIntoHistory_Start()

EmptyReplicatesQueueIntoHistory<T>(BasicQueue<T>, RingBuffer<T>)

Replicates which are enqueued will be removed from the queue and put into replicatesHistory. This should only be called when client only.

Declaration
protected void EmptyReplicatesQueueIntoHistory<T>(BasicQueue<T> replicatesQueue, RingBuffer<T> replicatesHistory)
    where T : IReplicateData
Parameters
Type Name Description
BasicQueue<T> replicatesQueue
RingBuffer<T> replicatesHistory
Type Parameters
Name Description
T

GetInstance<T>()

Returns class of type if found within CodegenBase classes.

Declaration
public T GetInstance<T>()
    where T : Component
Returns
Type Description
T
Type Parameters
Name Description
T

GiveOwnership(NetworkConnection)

Gives ownership to newOwner.

Declaration
public void GiveOwnership(NetworkConnection newOwner)
Parameters
Type Name Description
NetworkConnection newOwner

GiveOwnership(NetworkConnection, Boolean)

Gives ownership to newOwner.

Declaration
public void GiveOwnership(NetworkConnection newOwner, bool includeNested)
Parameters
Type Name Description
NetworkConnection newOwner
System.Boolean includeNested

OnDespawnServer(NetworkConnection)

Called on the server before a despawn message for this object has been sent to connection. Useful for sending remote calls or actions to clients.

Declaration
public virtual void OnDespawnServer(NetworkConnection connection)
Parameters
Type Name Description
NetworkConnection connection

OnOwnershipClient(NetworkConnection)

Called on the client after gaining or losing ownership.

Declaration
public virtual void OnOwnershipClient(NetworkConnection prevOwner)
Parameters
Type Name Description
NetworkConnection prevOwner

Previous owner of this object.

OnOwnershipServer(NetworkConnection)

Called on the server after ownership has changed.

Declaration
public virtual void OnOwnershipServer(NetworkConnection prevOwner)
Parameters
Type Name Description
NetworkConnection prevOwner

Previous owner of this object.

OnSpawnServer(NetworkConnection)

Called on the server after a spawn message for this object has been sent to clients. Useful for sending remote calls or data to clients.

Declaration
public virtual void OnSpawnServer(NetworkConnection connection)
Parameters
Type Name Description
NetworkConnection connection

Connection the object is being spawned for.

OnStartClient()

Called on the client after initializing this object.

Declaration
public virtual void OnStartClient()

OnStartNetwork()

Called when the network has initialized this object. May be called for server or client but will only be called once. When as host or server this method will run before OnStartServer. When as client only the method will run before OnStartClient.

Declaration
public virtual void OnStartNetwork()

OnStartServer()

Called on the server after initializing this object. SyncTypes modified before or during this method will be sent to clients in the spawn message.

Declaration
public virtual void OnStartServer()

OnStopClient()

Called on the client before deinitializing this object.

Declaration
public virtual void OnStopClient()

OnStopNetwork()

Called when the network is deinitializing this object. May be called for server or client but will only be called once. When as host or server this method will run after OnStopServer. When as client only this method will run after OnStopClient.

Declaration
public virtual void OnStopNetwork()

OnStopServer()

Called on the server before deinitializing this object.

Declaration
public virtual void OnStopServer()

OnValidate()

Declaration
protected virtual void OnValidate()

OwnerMatches(NetworkConnection)

Returns if a connection is the owner of this object.

Declaration
public bool OwnerMatches(NetworkConnection connection)
Parameters
Type Name Description
NetworkConnection connection
Returns
Type Description
System.Boolean

ReadPayload(NetworkConnection, Reader)

Called before network start callbacks, but after the object is initialized with network values. This may be used to read information from predicted spawning, or simply have values set before initialization without depending on SyncTypes.

Declaration
public virtual void ReadPayload(NetworkConnection connection, Reader reader)
Parameters
Type Name Description
NetworkConnection connection

Connection sending the payload. When coming from the server connection.IsValid will return false.

Reader reader

Reconcile_Client_Start()

This is called when the networkbehaviour should perform a reconcile. Codegen overrides this calling Reconcile_Client with the needed data.

Declaration
protected virtual void Reconcile_Client_Start()

Reconcile_Reader_Local<T>(UInt32, PooledReader)

Reads a local reconcile from the client.

Declaration
public T Reconcile_Reader_Local<T>(uint tick, PooledReader reader)
    where T : IReconcileData
Parameters
Type Name Description
System.UInt32 tick
PooledReader reader
Returns
Type Description
T
Type Parameters
Name Description
T

Reconcile_Reader<T>(PooledReader, ref T, Channel)

Reads a reconcile from the server.

Declaration
public void Reconcile_Reader<T>(PooledReader reader, ref T lastReconciledata, Channel channel)
    where T : IReconcileData
Parameters
Type Name Description
PooledReader reader
T lastReconciledata
Channel channel
Type Parameters
Name Description
T

Reconcile_Server<T>(UInt32, ref T, T, Channel)

Sends a reconcile to clients.

Declaration
public void Reconcile_Server<T>(uint methodHash, ref T lastReconcileData, T data, Channel channel)
    where T : IReconcileData
Parameters
Type Name Description
System.UInt32 methodHash
T lastReconcileData
T data
Channel channel
Type Parameters
Name Description
T

RegisterInstance<T>(T, Boolean)

Registers a new component to this NetworkManager.

Declaration
public void RegisterInstance<T>(T component, bool replace = true)
    where T : Component
Parameters
Type Name Description
T component

Reference of the component being registered.

System.Boolean replace

True to replace existing references.

Type Parameters
Name Description
T

Type to register.

RegisterInvokeOnInstance<T>(Action<Component>)

Invokes an action when a specified component becomes registered. Action will invoke immediately if already registered.

Declaration
public void RegisterInvokeOnInstance<T>(Action<Component> handler)
    where T : Component
Parameters
Type Name Description
System.Action<UnityEngine.Component> handler

Action to invoke.

Type Parameters
Name Description
T

Component type.

RemoveOwnership()

Removes ownership from all clients.

Declaration
public void RemoveOwnership()

Replicate_Replay_Authoritative<T>(UInt32, ReplicateUserLogicDelegate<T>, RingBuffer<T>, Channel)

Replays an input for authoritative entity.

Declaration
protected void Replicate_Replay_Authoritative<T>(uint replayTick, ReplicateUserLogicDelegate<T> del, RingBuffer<T> replicatesHistory, Channel channel)
    where T : IReplicateData
Parameters
Type Name Description
System.UInt32 replayTick
FishNet.Object.Prediction.Delegating.ReplicateUserLogicDelegate<T> del
RingBuffer<T> replicatesHistory
Channel channel
Type Parameters
Name Description
T

Replicate_Replay_NonAuthoritative<T>(UInt32, ReplicateUserLogicDelegate<T>, RingBuffer<T>, Channel)

Replays an input for non authoritative entity.

Declaration
protected void Replicate_Replay_NonAuthoritative<T>(uint replayTick, ReplicateUserLogicDelegate<T> del, RingBuffer<T> replicatesHistory, Channel channel)
    where T : IReplicateData
Parameters
Type Name Description
System.UInt32 replayTick
FishNet.Object.Prediction.Delegating.ReplicateUserLogicDelegate<T> del
RingBuffer<T> replicatesHistory
Channel channel
Type Parameters
Name Description
T

Replicate_Replay<T>(UInt32, ReplicateUserLogicDelegate<T>, RingBuffer<T>, Channel)

Replays inputs from replicates.

Declaration
protected void Replicate_Replay<T>(uint replayTick, ReplicateUserLogicDelegate<T> del, RingBuffer<T> replicatesHistory, Channel channel)
    where T : IReplicateData
Parameters
Type Name Description
System.UInt32 replayTick
FishNet.Object.Prediction.Delegating.ReplicateUserLogicDelegate<T> del
RingBuffer<T> replicatesHistory
Channel channel
Type Parameters
Name Description
T

Reset()

Declaration
protected virtual void Reset()

ResetState(Boolean)

Resets this NetworkBehaviour so that it may be added to an object pool.

Declaration
public virtual void ResetState(bool asServer)
Parameters
Type Name Description
System.Boolean asServer

SendServerRpc(UInt32, PooledWriter, Channel, DataOrderType)

Sends a RPC to server.

Declaration
protected void SendServerRpc(uint hash, PooledWriter methodWriter, Channel channel, DataOrderType orderType)
Parameters
Type Name Description
System.UInt32 hash
PooledWriter methodWriter
Channel channel
DataOrderType orderType

SendTargetRpc(UInt32, PooledWriter, Channel, DataOrderType, NetworkConnection, Boolean, Boolean)

Sends a RPC to target.

Declaration
protected void SendTargetRpc(uint hash, PooledWriter methodWriter, Channel channel, DataOrderType orderType, NetworkConnection target, bool excludeServer, bool validateTarget = true)
Parameters
Type Name Description
System.UInt32 hash
PooledWriter methodWriter
Channel channel
DataOrderType orderType
NetworkConnection target
System.Boolean excludeServer
System.Boolean validateTarget

Spawn(NetworkObject, NetworkConnection, Scene)

Spawns an object over the network. Can only be called on the server.

Declaration
public void Spawn(NetworkObject nob, NetworkConnection ownerConnection = null, Scene scene = default(Scene))
Parameters
Type Name Description
NetworkObject nob

GameObject instance to spawn.

NetworkConnection ownerConnection

Connection to give ownership to.

UnityEngine.SceneManagement.Scene scene

Spawn(GameObject, NetworkConnection, Scene)

Spawns an object over the network. Can only be called on the server.

Declaration
public void Spawn(GameObject go, NetworkConnection ownerConnection = null, Scene scene = default(Scene))
Parameters
Type Name Description
UnityEngine.GameObject go

GameObject instance to spawn.

NetworkConnection ownerConnection

Connection to give ownership to.

UnityEngine.SceneManagement.Scene scene

ToString()

Outputs data about this NetworkBehaviour to string.

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
UnityEngine.Object.ToString()

TryRegisterInstance<T>(T)

Tries to registers a new component to this NetworkManager. This will not register the instance if another already exists.

Declaration
public bool TryRegisterInstance<T>(T component)
    where T : Component
Parameters
Type Name Description
T component

Reference of the component being registered.

Returns
Type Description
System.Boolean

True if was able to register, false if an instance is already registered.

Type Parameters
Name Description
T

Type to register.

UnregisterInstance<T>()

Unregisters a component from this NetworkManager.

Declaration
public void UnregisterInstance<T>()
    where T : Component
Type Parameters
Name Description
T

Type to unregister.

UnregisterInvokeOnInstance<T>(Action<Component>)

Removes an action to be invoked when a specified component becomes registered.

Declaration
public void UnregisterInvokeOnInstance<T>(Action<Component> handler)
    where T : Component
Parameters
Type Name Description
System.Action<UnityEngine.Component> handler

Action to invoke.

Type Parameters
Name Description
T

Component type.

WritePayload(NetworkConnection, Writer)

Called when writing a spawn. This may be used to deliver information for predicted spawning, or simply have values set before initialization without depending on SyncTypes.

Declaration
public virtual void WritePayload(NetworkConnection connection, Writer writer)
Parameters
Type Name Description
NetworkConnection connection

Connection receiving the payload. When sending to the server connection.IsValid will return false.

Writer writer
In This Article
Back to top Generated by DocFX