Table of Contents

Class NetworkObject

Namespace
Netick
Assembly
Netick.dll

Any GameObject which needs to be synced/replicated must have a Network Object component. It’s the component that tells Netick a GameObject is networked. Although not every child GameObject needs it, only the root has to have a Network Object.

[AddComponentMenu("Netick/Network Object")]
[DisallowMultipleComponent]
[SerializeField]
public sealed class NetworkObject : MonoBehaviour
Inheritance
Object
Component
Behaviour
MonoBehaviour
NetworkObject
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

NetworkObject()

public NetworkObject()

Properties

HasValidId

Returns true if this NetworkObject has been added to the simulation by Netick, and thus has a valid id.

[SerializeField]
public bool HasValidId { get; }

Property Value

bool

Id

The network id of this NetworkObject.

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

IsInputSource

Returns true if this LocalPlayer is providing inputs for this NetworkObject.

public bool IsInputSource { get; }

Property Value

bool

IsOwner

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

public bool IsOwner { get; }

Property Value

bool

IsPrefabObject

public bool IsPrefabObject { get; }

Property Value

bool

IsProxy

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

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

IsSceneObject

[SerializeField]
public bool IsSceneObject { get; }

Property Value

bool

IsSpawnPredicted

public bool IsSpawnPredicted { get; }

Property Value

bool

Parent

The NetworkObject parent of this object.

public NetworkObject Parent { get; }

Property Value

NetworkObject

PredictionMode

public Relevancy PredictionMode { get; }

Property Value

Relevancy

Sandbox

The NetworkSandbox containing this NetworkObject.

public NetworkSandbox Sandbox { get; }

Property Value

NetworkSandbox

SpawnPredictionKey

public SpawnPredictionKey SpawnPredictionKey { get; }

Property Value

SpawnPredictionKey

SpawnTick

The tick which this object was spawned at.

public Tick SpawnTick { get; }

Property Value

Tick

Methods

GetBehaviourById<T>(int)

public T GetBehaviourById<T>(int id) where T : NetworkBehaviour

Parameters

id int

Returns

T

Type Parameters

T

GetBehaviour<T>()

public T GetBehaviour<T>() where T : NetworkBehaviour

Returns

T

Type Parameters

T

GetSceneId()

public int GetSceneId()

Returns

int

PermitInput(NetworkPlayer)

[Owner Only] Permit source to provide inputs to this object.

public void PermitInput(NetworkPlayer source)

Parameters

source NetworkPlayer

The player to be given permission.

RevokeInput()

[Owner Only] Removes the current Input Source (InputSource) of this object.

public void RevokeInput()

SetObjectDirty()

public void SetObjectDirty()

SetParent(NetworkObject)

[Owner/InputSource Only] Changes the parent of this object.

public void SetParent(NetworkObject obj)

Parameters

obj NetworkObject

The object which will become the parent of this object.