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.

[HideInInspector]
[DisallowMultipleComponent]
public sealed class Network : MonoBehaviour
Inheritance
Object
Component
Behaviour
MonoBehaviour
Network
Inherited Members
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.destroyCancellationToken
MonoBehaviour.useGUILayout
MonoBehaviour.runInEditMode
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.GetComponent<T>()
Component.TryGetComponent<T>(out T)
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren<T>()
Component.GetComponentInParent<T>()
Component.GetComponentsInParent<T>()
Component.GetComponents<T>()
Component.transform
Component.gameObject
Component.tag
Object.GetInstanceID()
Object.GetHashCode()
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.ToString()
Object.name
Object.hideFlags
Extension Methods

Fields

Version

public const string Version = "0.12.22"

Field Value

string

Properties

Config

public static NetickConfig Config { get; }

Property Value

NetickConfig

Instance

public static Network Instance { get; }

Property Value

Network

IsHeadless

public static bool IsHeadless { get; }

Property Value

bool

IsRunning

public static bool IsRunning { get; }

Property Value

bool

Sandboxes

public static IReadOnlyList<NetworkSandbox> Sandboxes { get; }

Property Value

IReadOnlyList<NetworkSandbox>

StartMode

public static StartMode StartMode { get; }

Property Value

StartMode

Methods

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(StartMode, LaunchData)

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

Parameters

mode StartMode
launchData LaunchData

Returns

Network.LaunchResults

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)

Starts Netick as a client.

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

Parameters

transportProvider NetworkTransportProvider
port int
sandboxPrefab GameObject

Returns

NetworkSandbox

The sandbox representing the client

StartAsHost(NetworkTransportProvider, int, GameObject)

Starts Netick as a host.

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

Parameters

transportProvider NetworkTransportProvider
port int

Network port.

sandboxPrefab GameObject

Returns

NetworkSandbox

The sandbox representing the server

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

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)

Parameters

transportProvider NetworkTransportProvider
port int
sandboxPrefab GameObject
startAServer bool

Should we start a server too.

startServerAsHost bool
numOfClients int

Number of clients to create.

Returns

Network.LaunchResults

StartAsServer(NetworkTransportProvider, int, GameObject)

Starts Netick as a server.

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

Parameters

transportProvider NetworkTransportProvider
port int

Network port.

sandboxPrefab GameObject

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 StartAsMultiplePeers 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)

Starts Netick in single player mode.

public static NetworkSandbox StartAsSinglePlayer(GameObject sandboxPrefab = null)

Parameters

sandboxPrefab GameObject

Returns

NetworkSandbox

The sandbox representing the server