Class Manus::Networking::NetObjectManager
ClassList > Manus > Networking > NetObjectManager
This Manager ensures that all NetObjects (if used correctly) have Unique IDs. The NetObjectManager should only be used via the NetworkManager, Server and Client. Using it elsewhere may cause out of sync problems.
Public Functions
Type | Name |
---|---|
void | AddNetObject (NetObject p_Obj) Adds a NetObject to the list of NetObjects. Uses the NetID defined in the NetObject. |
void | AddNetObject (long p_NetID, NetObject p_Obj) Adds a NetObject with a given NetID to the list of NetObjects. Does not assign the NetObject's NetID! |
void | AddNetObjects (NetObject[] p_NetObjs) Add NetObjects, initialize them with the correct NetID's and PrefabIDs. Ensures that NetObjects get tracked when starting as a Server for enabling. |
void | EnableNetObjectsOnServer () Enables all the NetObjects that are defined to be activated when hosting as a Server. |
NetObject | GetNetObject (long p_NetID) Get the NetObject with a given NetID. |
List< NetObject > | GetNetObjects () Returns all the NetObjects. |
List< NetObject > | GetNetObjectsControlledByPlayer (long p_PlayerNetID) Returns all the NetObjects that a given player controls. |
long | GetNextNetID () Get the next NetID. The current implementation has a range of the Long type, which should be more than enough. (-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807) |
void | InitializeControlOfAllObjects (long p_PlayerNetID) Sets all the NetObjects' controllers to a given PlayerNetID. |
NetObjectManager () |
|
bool | RemoveNetObject (long p_NetID) Removes a NetObject with a given NetID from the list of NetObjects. |
int | WriteAllNetObjectData (ref LidNet.NetBuffer p_Buffer) Writes all NetObject data to a NetBuffer. Does not clean dirty data. It returns the amount of NetObjects written to the buffer. |
int | WriteDirtyNetObjectData (ref LidNet.NetBuffer p_Buffer) Writes all dirty NetObject data to a NetBuffer. Automatically cleans the dirty data. It returns the amount of NetObjects written to the buffer. |
Public Functions Documentation
function AddNetObject [1/2]
Adds a NetObject to the list of NetObjects. Uses the NetID defined in the NetObject.
Parameters:
p_Obj
NetObject to add
function AddNetObject [2/2]
Adds a NetObject with a given NetID to the list of NetObjects. Does not assign the NetObject's NetID!
Parameters:
p_NetID
NetID to usep_Obj
NetObject to add
function AddNetObjects
Add NetObjects, initialize them with the correct NetID's and PrefabIDs. Ensures that NetObjects get tracked when starting as a Server for enabling.
Parameters:
p_NetObjs
The objects to add and initialize
function EnableNetObjectsOnServer
function GetNetObject
Get the NetObject with a given NetID.
Parameters:
p_NetID
NetID to get
Returns:
function GetNetObjects
Returns all the NetObjects.
Returns:
A List of NetObjects
function GetNetObjectsControlledByPlayer
Returns all the NetObjects that a given player controls.
inline List< NetObject > Manus::Networking::NetObjectManager::GetNetObjectsControlledByPlayer (
long p_PlayerNetID
)
Parameters:
p_PlayerNetID
The controller's ID
Returns:
A List of NetObjects
function GetNextNetID
Get the next NetID. The current implementation has a range of the Long type, which should be more than enough. (-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807)
Returns:
Next ID
function InitializeControlOfAllObjects
Sets all the NetObjects' controllers to a given PlayerNetID.
inline void Manus::Networking::NetObjectManager::InitializeControlOfAllObjects (
long p_PlayerNetID
)
Parameters:
p_PlayerNetID
The Player ID to set as the controller of all the NetObjects
function NetObjectManager
function RemoveNetObject
Removes a NetObject with a given NetID from the list of NetObjects.
Parameters:
p_NetID
NetID to remove
Returns:
Return true if successful
function WriteAllNetObjectData
Writes all NetObject data to a NetBuffer. Does not clean dirty data. It returns the amount of NetObjects written to the buffer.
inline int Manus::Networking::NetObjectManager::WriteAllNetObjectData (
ref LidNet.NetBuffer p_Buffer
)
Parameters:
p_Buffer
Returns:
Amount of NetObjects written to the buffer
function WriteDirtyNetObjectData
Writes all dirty NetObject data to a NetBuffer. Automatically cleans the dirty data. It returns the amount of NetObjects written to the buffer.
inline int Manus::Networking::NetObjectManager::WriteDirtyNetObjectData (
ref LidNet.NetBuffer p_Buffer
)
Parameters:
p_Buffer
Returns:
Amount of NetObjects written to the buffer
The documentation for this class was generated from the following file api/unity-plugin/Scripts/Networking/NetObjectManager.cs