Skip to content

Class Manus::Networking::SimpleNetworkManager

ClassList > Manus > Networking > SimpleNetworkManager

A sample NetworkManager implementation which can be used to host or join a game with client/server specific implementations.

Inherits the following classes: Manus::Networking::NetworkManager

Public Types inherited from Manus::Networking::NetworkManager

See Manus::Networking::NetworkManager

Type Name
enum Status
The different statuses the NetworkManager can have.

Public Attributes inherited from Manus::Networking::NetworkManager

See Manus::Networking::NetworkManager

Type Name
string appIdentifier = = "MyApp"
This variable defines which applications it can find and be found by. It should be unique for every project made with the NetworkManager.
NetObject playerPrefab
The player prefab that is spawned when a player joins.
Vector3 playerSpawnPostion = = Vector3.zero
The world position the Players are spawned in as.
Vector3 playerSpawnRotation = = Vector3.zero
The world rotation the Players are spawned in as.
int port = = 6969
The port on which the NetworkManager creates the Server at.

Public Properties

Type Name
property SimpleServer server
Casts the Peer to a SimpleServer. Returns NULL if not a SimpleServer.

Public Properties inherited from Manus::Networking::NetworkManager

See Manus::Networking::NetworkManager

Type Name
property Status status
The current status of the NetworkManager.

Public Static Properties inherited from Manus::Networking::NetworkManager

See Manus::Networking::NetworkManager

Type Name
property NetworkManager instance
Get the NetworkManager.

Public Functions

Type Name
virtual override Client CreateClient (NetworkManager p_Man, string p_AppID)
Instantiates a SimpleClient when called by the NetworkManager. (Client functions)
virtual override Server CreateServer (NetworkManager p_Man, string p_AppID, int p_Port)
Instantiates a SimpleServer when called by the NetworkManager. (Host & Server functions)

Public Functions inherited from Manus::Networking::NetworkManager

See Manus::Networking::NetworkManager

Type Name
void Client ()
Creates a client for this game instance.
void Connect (string p_Host, int p_Port)
If there is a Client available, connect to a Server at a given address and port.
void Connect (System.Net.IPEndPoint p_RemoteEndPoint)
If there is a Client available, connect to a given Remote End Point. This function should be used in combination with the results of a LAN Discovery.
virtual Client CreateClient (NetworkManager p_Man, string p_AppID)
Function called when creating a client, this function needs to be overridden to use a custom Client implementation!
virtual Server CreateServer (NetworkManager p_Man, string p_AppID, int p_Port)
Function called when creating a server, this function needs to be overridden to use a custom Server implementation!
void DestroyObject (NetObject p_Obj)
Call this function when an object needs to be destroyed.
void DiscoverLan ()
If the Client is running, find servers on the LAN.
Client GetClient ()
Returns the Client, if any is available. Returns NULL if no Client is available.
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.
Peer GetPeer ()
Returns the Peer, if any is available. Returns NULL if no Peer available.
Server GetServer ()
Returns the Server, if any is available. Returns NULL if no Server is available.
void Host ()
Creates a server and spawns the Player Prefab for this game instance.
void ReleaseControlOfObject (NetObject p_Obj)
Call this function when you want to release control of an object.
void SendNetMessage (Message.Type p_Type, LidNet.NetBuffer p_Msg)
Call this function when you want to send a message.
void SendNetMessage (ushort p_Type, LidNet.NetBuffer p_Msg)
Call this function when you want to send a message.
void Server ()
Creates a server and does NOT spawn a Player Prefab for this game instance.
NetObject SpawnObject (NetObject p_Obj, Vector3 p_Position, Quaternion p_Rotation)
Call this function when an object needs to be created. Make sure this NetObject is in the resources folder! The return will be NULL if used as a client!
void TakeControlOfObject (NetObject p_Obj)
Call this function when you want to take control of an object.

Public Static Functions inherited from Manus::Networking::NetworkManager

See Manus::Networking::NetworkManager

Type Name
NetObject[] GetPrefabs ()
Gets all registered NetObject Prefabs.

Protected Attributes inherited from Manus::Networking::NetworkManager

See Manus::Networking::NetworkManager

Type Name
Peer m_Peer = = null
Status m_Status

Public Properties Documentation

property server

SimpleServer Manus.Networking.SimpleNetworkManager.server;

Public Functions Documentation

function CreateClient

Instantiates a SimpleClient when called by the NetworkManager. (Client functions)

inline virtual override Client Manus::Networking::SimpleNetworkManager::CreateClient (
    NetworkManager p_Man,
    string p_AppID
) 

Parameters:

  • p_Man The Network Manager
  • p_AppID The AppID

Returns:

Returns the created Server

Implements Manus::Networking::NetworkManager::CreateClient

function CreateServer

Instantiates a SimpleServer when called by the NetworkManager. (Host & Server functions)

inline virtual override Server Manus::Networking::SimpleNetworkManager::CreateServer (
    NetworkManager p_Man,
    string p_AppID,
    int p_Port
) 

Parameters:

  • p_Man The Network Manager
  • p_AppID The AppID
  • p_Port The Port

Returns:

Returns the created Server

Implements Manus::Networking::NetworkManager::CreateServer


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