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
-
ObjectComponentBehaviourMonoBehaviourNetworkObject
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.useGUILayoutMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.transformComponent.gameObjectComponent.tagObject.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.nameObject.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
Id
The network id of this NetworkObject.
public int Id { get; }
Property Value
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
IsInputSource
Returns true if this LocalPlayer is providing inputs for this NetworkObject.
public bool IsInputSource { get; }
Property Value
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
IsPrefabObject
public bool IsPrefabObject { get; }
Property Value
IsProxy
Returns true if we neither provide inputs nor own this NetworkObject.
public bool IsProxy { get; }
Property Value
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
IsSceneObject
[SerializeField]
public bool IsSceneObject { get; }
Property Value
IsSpawnPredicted
public bool IsSpawnPredicted { get; }
Property Value
Parent
The NetworkObject parent of this object.
public NetworkObject Parent { get; }
Property Value
PredictionMode
public Relevancy PredictionMode { get; }
Property Value
Sandbox
The NetworkSandbox containing this NetworkObject.
public NetworkSandbox Sandbox { get; }
Property Value
SpawnPredictionKey
public SpawnPredictionKey SpawnPredictionKey { get; }
Property Value
SpawnTick
The tick which this object was spawned at.
public Tick SpawnTick { get; }
Property Value
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
PermitInput(NetworkPlayer)
[Owner Only] Permit source
to provide inputs to this object.
public void PermitInput(NetworkPlayer source)
Parameters
source
NetworkPlayerThe 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
NetworkObjectThe object which will become the parent of this object.