Networkingclass
Global manager to hold and tick the singleton instance of NetworkSystem.
Methods14
Showing 14 methods
public static void Disconnect()
Disconnect from current multiplayer session.
void—public static Sandbox.Connection FindConnection(System.Guid id)
Obsolete: Moved to Connection.Find
| Parameter | Type | Description |
|---|---|---|
| id | Guid | — |
public static string GetData(string key, string defaultValue)
Get data about the current server or lobby. This data can be used for filtering when querying lobbies.
| Parameter | Type | Description |
|---|---|---|
| key | string | — |
| defaultValue | string | — |
string—public static System.Threading.Tasks.Task`1<bool> JoinBestLobby(string ident)
Try to join the best lobby. Return true on success.
| Parameter | Type | Description |
|---|---|---|
| ident | string | — |
Task<bool>—public static void SetData(string key, string value)
Set data about the current server or lobby. Other players can query this when searching for a game. Note: for now, try to keep the key and value as short as possible, Steam enforce a character limit on server tags, so it could be possible to reach that limit when running a Dedicated Server. In the future we'll store this stuff on our backend, so that won't be a problem.
| Parameter | Type | Description |
|---|---|---|
| key | string | — |
| value | string | — |
void—No results match this filter.
Properties10
Showing 10 properties
public static System.Collections.Generic.IReadOnlyList`1<Sandbox.Connection> Sandbox.Networking.Connections { get; set; }
A list of connections that are currently on this server. If you're not on a server this will return only one connection (Connection.Local). Some games restrict the connection list - in which case you will get an empty list.
Obsolete: Moved to Connection.All
public static Sandbox.Connection Sandbox.Networking.HostConnection { get; set; }
The connection of the current network host.
Obsolete: Moved to Connection.Host
public static Sandbox.Network.HostStats Sandbox.Networking.HostStats { get; set; }
Get the latest host stats such as bandwidth used and the current frame rate.
public static bool Sandbox.Networking.IsActive { get; set; }
True if we're currently connecting to the server
bool—public static bool Sandbox.Networking.IsClient { get; set; }
True if we're currently connected to a server, and we are not the host
bool—public static bool Sandbox.Networking.IsConnecting { get; set; }
True if we're currently connecting to the server
bool—public static bool Sandbox.Networking.IsHost { get; set; }
True if we can be considered the host of this session. Either we're not connected to a server, or we are host of a server.
bool—public static string Sandbox.Networking.MapName { get; set; }
The name of the map being used on the server you're connected to.
string—public static int Sandbox.Networking.MaxPlayers { get; set; }
The maximum number of players allowed on the server you're connected to.
int—public static string Sandbox.Networking.ServerName { get; set; }
The name of the server you are currently connected to.
string—No results match this filter.