Table of Contents

Class Network

Namespace
Netick.Unity
Assembly
Netick.Unity.dll

Manages Netick and its sandboxes, and is used to start and shut down Netick.

public sealed class Network : MonoBehaviour
Inheritance
Network

Fields

Version

The version of Netick.

public const string Version = "0.15.30"

Field Value

string

Properties

Config

Returns the configuration (of the first sandbox) used by Netick.

public static NetickConfig Config { get; }

Property Value

NetickConfig

GameVersion

public static int GameVersion { get; }

Property Value

int

Instance

Returns the singleton instance of the Network class, which manages Netick.

public static Network Instance { get; }

Property Value

Network

IsHeadless

Returns true if Netick is running in headless mode (batch mode), false otherwise.

public static bool IsHeadless { get; }

Property Value

bool

IsRunning

Returns true if Netick is running, false otherwise.

public static bool IsRunning { get; }

Property Value

bool

Sandboxes

Returns the list of all sandboxes currently running in Netick.

public static IReadOnlyList<NetworkSandbox> Sandboxes { get; }

Property Value

IReadOnlyList<NetworkSandbox>

StartMode

The start mode of Netick.

public static StartMode StartMode { get; }

Property Value

StartMode

Methods

CloneDefaultConfig()

public static NetickConfig CloneDefaultConfig()

Returns

NetickConfig

Focus(NetworkSandbox)

Focus on a specific sandbox.

public static void Focus(NetworkSandbox sandbox)

Parameters

sandbox NetworkSandbox

The sandbox to focus on.

Init(NetickConfig)

Initializes Netick. This is automatically called when you start Netick.

If you don't provide a NetickConfig, Netick will use the default config, which can be modified/found in (Netick -> Settings).

public static void Init(NetickConfig config = null)

Parameters

config NetickConfig

Launch(SandboxLaunchData)

public static NetworkSandbox Launch(SandboxLaunchData sandbox)

Parameters

sandbox SandboxLaunchData

Returns

NetworkSandbox

Launch(StartMode, LaunchData)

public static Network.LaunchResults Launch(StartMode mode, LaunchData launchData)

Parameters

mode StartMode
launchData LaunchData

Returns

Network.LaunchResults

Launch(List<SandboxLaunchData>)

public static List<NetworkSandbox> Launch(List<SandboxLaunchData> sandboxes)

Parameters

sandboxes List<SandboxLaunchData>

Returns

List<NetworkSandbox>

Shutdown(bool)

Shuts down Netick and destroys all sandboxes. The shutdown will occur in the next frame. For immediate shutdown, use: ShutdownImmediately(bool)

public static void Shutdown(bool destroyAllNetworkObjects = false)

Parameters

destroyAllNetworkObjects bool

ShutdownImmediately(bool)

Shuts down Netick and destroys all sandboxes immediately.

public static void ShutdownImmediately(bool destroyAllNetworkObjects = false)

Parameters

destroyAllNetworkObjects bool

ShutdownSandbox(NetworkSandbox, bool)

Shuts down a specific sandbox.

public static void ShutdownSandbox(NetworkSandbox sandbox, bool destroyAllNetworkObjects = false)

Parameters

sandbox NetworkSandbox

The sandbox to shut down.

destroyAllNetworkObjects bool

StartAsClient(NetworkTransportProvider, int, GameObject, NetickConfig)

Starts Netick as a client.

public static NetworkSandbox StartAsClient(NetworkTransportProvider transportProvider, int port, GameObject sandboxPrefab = null, NetickConfig config = null)

Parameters

transportProvider NetworkTransportProvider
port int
sandboxPrefab GameObject
config NetickConfig

Returns

NetworkSandbox

The sandbox representing the client

StartAsClient(NetworkTransportProvider, GameObject, NetickConfig)

Starts Netick as a client.

public static NetworkSandbox StartAsClient(NetworkTransportProvider transportProvider, GameObject sandboxPrefab = null, NetickConfig config = null)

Parameters

transportProvider NetworkTransportProvider
sandboxPrefab GameObject
config NetickConfig

Returns

NetworkSandbox

The sandbox representing the client

StartAsHost(NetworkTransportProvider, int, GameObject, NetickConfig)

Starts Netick as a host.

public static NetworkSandbox StartAsHost(NetworkTransportProvider transportProvider, int port, GameObject sandboxPrefab = null, NetickConfig config = null)

Parameters

transportProvider NetworkTransportProvider
port int

Network port.

sandboxPrefab GameObject
config NetickConfig

Returns

NetworkSandbox

The sandbox representing the server

StartAsMultiplePeers(NetworkTransportProvider, int, GameObject, bool, bool, int, NetickConfig)

Starts multiple peers together.

public static Network.LaunchResults StartAsMultiplePeers(NetworkTransportProvider transportProvider, int port, GameObject sandboxPrefab = null, bool startAServer = true, bool startServerAsHost = true, int numOfClients = 1, NetickConfig config = null)

Parameters

transportProvider NetworkTransportProvider
port int
sandboxPrefab GameObject
startAServer bool

Should we start a server too.

startServerAsHost bool
numOfClients int

Number of clients to create.

config NetickConfig

Returns

Network.LaunchResults

StartAsReplayClient(GameObject, NetickConfig)

Starts Netick as a replay client.

public static NetworkSandbox StartAsReplayClient(GameObject sandboxPrefab = null, NetickConfig config = null)

Parameters

sandboxPrefab GameObject
config NetickConfig

Returns

NetworkSandbox

The sandbox representing the client

StartAsServer(NetworkTransportProvider, int, GameObject, NetickConfig)

Starts Netick as a server.

public static NetworkSandbox StartAsServer(NetworkTransportProvider transportProvider, int port, GameObject sandboxPrefab = null, NetickConfig config = null)

Parameters

transportProvider NetworkTransportProvider
port int

Network port.

sandboxPrefab GameObject
config NetickConfig

Returns

NetworkSandbox

The sandbox representing the server

StartAsServerAndClient(NetworkTransportProvider, int, GameObject, int)

Starts both a client (or clients) and a server.

[Obsolete("This is obsolete. Use Launch instead.")]
public static Network.LaunchResults StartAsServerAndClient(NetworkTransportProvider transportProvider, int serverPort, GameObject sandboxPrefab = null, int numOfClients = 1)

Parameters

transportProvider NetworkTransportProvider
serverPort int

Network port.

sandboxPrefab GameObject
numOfClients int

Number of client sandboxes to create.

Returns

Network.LaunchResults

StartAsSinglePlayer(GameObject, NetickConfig)

Starts Netick in single player mode.

public static NetworkSandbox StartAsSinglePlayer(GameObject sandboxPrefab = null, NetickConfig config = null)

Parameters

sandboxPrefab GameObject
config NetickConfig

Returns

NetworkSandbox

The sandbox representing the server