Skip to content

Class Manus::Networking::NetObject

ClassList > Manus > Networking > NetObject

This is the Networked Object behaviour, it contains the most basic required information on a Networked Object. The NetObject has information on Ownership and Ownership changes. It keeps track of all the Syncables and helps manage data changes and gathering.

Inherits the following classes: MonoBehaviour

Public Attributes

Type Name
bool destroyOnControllerDisconnected = = false
long m_ControllerID = = 0
long m_NetID = = long.MinValue
int m_PrefabID = = int.MinValue
UnityEngine.Events.UnityEvent onGainOwnership
UnityEngine.Events.UnityEvent onLoseOwnership

Public Properties

Type Name
property bool isOwnedByMe
Does this instance own this NetObject.
property List< Sync.BaseSync > syncables
Get this objects syncables.

Public Functions

Type Name
long GetControllerID ()
Get this object's controller ID.
Sync.BaseSync GetSyncable (int p_Idx)
Get a syncable for a given index.
int GetSyncableIndex (Sync.BaseSync p_Syncable)
Get a sync's Index.
bool Initialize (long p_ID, int p_PrefabID=int.MinValue, bool p_AutoDisable=true)
Function called when initializing the object. This function should only be called by the Network Manager.
bool IsDirty ()
Has the data changed since last Write?
void ReceiveAllData (LidNet.NetBuffer p_Msg)
Receives and applies all the data in the Net Buffer. Assumes all the data passed in exists as Syncable.
void ReceiveData (LidNet.NetBuffer p_Msg)
Receives and applies all the data from specific Syncables the Net Buffer.
bool SetControllerID (long p_ControllerID, long p_MyID)
Sets the NetObject's ID, returns true if MyID owns this object.
void WriteAllData (LidNet.NetBuffer p_Msg)
Writes all the data to the Net Buffer for sending.
void WriteData (LidNet.NetBuffer p_Msg)
Write the dirty data to a Net Buffer for sending. Automatically sets the data to clean!

Public Attributes Documentation

variable destroyOnControllerDisconnected

bool Manus.Networking.NetObject.destroyOnControllerDisconnected;

variable m_ControllerID

long Manus.Networking.NetObject.m_ControllerID;

variable m_NetID

long Manus.Networking.NetObject.m_NetID;

variable m_PrefabID

int Manus.Networking.NetObject.m_PrefabID;

variable onGainOwnership

UnityEngine.Events.UnityEvent Manus.Networking.NetObject.onGainOwnership;

variable onLoseOwnership

UnityEngine.Events.UnityEvent Manus.Networking.NetObject.onLoseOwnership;

Public Properties Documentation

property isOwnedByMe

bool Manus.Networking.NetObject.isOwnedByMe;

property syncables

Get this objects syncables.

List<Sync.BaseSync> Manus.Networking.NetObject.syncables;

Returns:

A list of syncables

Public Functions Documentation

function GetControllerID

Get this object's controller ID.

inline long Manus::Networking::NetObject::GetControllerID () 

Returns:

Controller ID

function GetSyncable

Get a syncable for a given index.

inline Sync.BaseSync Manus::Networking::NetObject::GetSyncable (
    int p_Idx
) 

Returns:

Syncable, NULL when not found

function GetSyncableIndex

Get a sync's Index.

inline int Manus::Networking::NetObject::GetSyncableIndex (
    Sync.BaseSync p_Syncable
) 

Returns:

Index

function Initialize

Function called when initializing the object. This function should only be called by the Network Manager.

inline bool Manus::Networking::NetObject::Initialize (
    long p_ID,
    int p_PrefabID=int.MinValue,
    bool p_AutoDisable=true
) 

Parameters:

  • p_ID Object ID
  • p_PrefabID Prefab ID
  • p_AutoDisable Does this object automatically disable itself?

Returns:

function IsDirty

Has the data changed since last Write?

inline bool Manus::Networking::NetObject::IsDirty () 

Returns:

function ReceiveAllData

Receives and applies all the data in the Net Buffer. Assumes all the data passed in exists as Syncable.

inline void Manus::Networking::NetObject::ReceiveAllData (
    LidNet.NetBuffer p_Msg
) 

Parameters:

  • p_Msg

function ReceiveData

Receives and applies all the data from specific Syncables the Net Buffer.

inline void Manus::Networking::NetObject::ReceiveData (
    LidNet.NetBuffer p_Msg
) 

Parameters:

  • p_Msg

function SetControllerID

Sets the NetObject's ID, returns true if MyID owns this object.

inline bool Manus::Networking::NetObject::SetControllerID (
    long p_ControllerID,
    long p_MyID
) 

Parameters:

  • p_ControllerID
  • p_MyID

Returns:

True if I own this object

function WriteAllData

Writes all the data to the Net Buffer for sending.

inline void Manus::Networking::NetObject::WriteAllData (
    LidNet.NetBuffer p_Msg
) 

Parameters:

  • p_Msg

function WriteData

Write the dirty data to a Net Buffer for sending. Automatically sets the data to clean!

inline void Manus::Networking::NetObject::WriteData (
    LidNet.NetBuffer p_Msg
) 

Parameters:

  • p_Msg

The documentation for this class was generated from the following file api/unity-plugin/Scripts/Networking/NetObject.cs