Learn more about network machines and what you can use them for.

Network machines are Unity components that are added to game objects. They’re mostly used reacting to network events, e.g. a player connecting to a server.

A network machine component can be added through the components menu (Makinom > Machines > Network Machine) or the scene wizard (Add Machine > Network Machine). A game object with a network machine is represented in the Unity scene view by this gizmo icon:

NetworkMachineComponent Icon

You can learn more about machine components in general and their basic settings in this how-to.

WarningPlease note that Unity 2019 removed the UNet multiplayer feature and it is not available in Makinom versions for Unity 2019 and above. The network machine is only available in Makinom versions for Unity 2018 and below.

UNET Client Start Types

A network machine is started by UNET callback functions. These start types are used on the client’s side.

Client Connect

Started on the client when successfully connected to a server.

Local Start Variables

This start type will automatically initialize the following local variables.

  • isReady (bool)
    Stores if the connection is set ready or not.
  • connectionId (int)
    Stores the connection’s unique identifier.
  • hostId (int)
    Stores the transport level host ID of the connection.
  • address (string)
    Stores the IP address associated with the connection.

Example

This start type can be used to load a scene after connecting to a server. Use a Load Scene node to load a scene.

Client Disconnect

Started on the client when disconnected from a server.

Local Start Variables

This start type will automatically initialize the following local variables.

  • isReady (bool)
    Stores if the connection is set ready or not.
  • connectionId (int)
    Stores the connection’s unique identifier.
  • hostId (int)
    Stores the transport level host ID of the connection.
  • address (string)
    Stores the IP address associated with the connection.

Example

This start type can be used to load a scene after being disconnected from a server. Use a Load Scene node to load a scene.

Client Error

Started on the client when a network error occured.

Local Start Variables

This start type will automatically initialize the following local variables.

  • isReady (bool)
    Stores if the connection is set ready or not.
  • errorCode (int)
    Stores the code of the error that occured.
  • connectionId (int)
    Stores the connection’s unique identifier.
  • hostId (int)
    Stores the transport level host ID of the connection.
  • address (string)
    Stores the IP address associated with the connection.

Example

This start type can be used to show an error notification to the player. Use a Show Dialogue node to display a message.

Client Not Ready

Started on the client when the server sets it to no longer be ready.

Local Start Variables

This start type will automatically initialize the following local variables.

  • isReady (bool)
    Stores if the connection is set ready or not.
  • connectionId (int)
    Stores the connection’s unique identifier.
  • hostId (int)
    Stores the transport level host ID of the connection.
  • address (string)
    Stores the IP address associated with the connection.

Example

This start type can be used to do client sided setups and set the client ready again. Use a Set Client Ready node to set the client ready.

Client Scene Changed

Started on the client after a scene has been completely loaded, when the scene change was initiated by the server.

Example

This start type can be used to set the client ready after the scene change. Use a Set Client Ready node to set the client ready.

UNET Server Start Types

A network machine is started by UNET callback functions. These start types are used on the server’s side.

Server Add Player

Started on the server when a client adds a new player.

Local Start Variables

This start type will automatically initialize the following local variables.

  • isReady (bool)
    Stores if the connection is set ready or not.
  • playerControllerId (int)
    Stores the ID of the player controller, a client can have multiple local players.
  • connectionId (int)
    Stores the connection’s unique identifier.
  • hostId (int)
    Stores the transport level host ID of the connection.
  • address (string)
    Stores the IP address associated with the connection.

Example

This start type can be used to do server side setups for a new player or a player counter. Use a Change Variables node to change variables.

Server Connect

Started on the server when a new client connects.

Local Start Variables

This start type will automatically initialize the following local variables.

  • isReady (bool)
    Stores if the connection is set ready or not.
  • connectionId (int)
    Stores the connection’s unique identifier.
  • hostId (int)
    Stores the transport level host ID of the connection.
  • address (string)
    Stores the IP address associated with the connection.

Example

This start type can be used to do server side setups or a client counter. Use a Change Variables node to change variables.

Server Disconnect

Started on the server when a client disconnects.

Local Start Variables

This start type will automatically initialize the following local variables.

  • isReady (bool)
    Stores if the connection is set ready or not.
  • connectionId (int)
    Stores the connection’s unique identifier.
  • hostId (int)
    Stores the transport level host ID of the connection.
  • address (string)
    Stores the IP address associated with the connection.

Example

This start type can be used to do server side setups or a client counter. Use a Change Variables node to change variables.

Server Error

Started on the server when a network error occurs for a client connection.

Local Start Variables

This start type will automatically initialize the following local variables.

  • isReady (bool)
    Stores if the connection is set ready or not.
  • errorCode (int)
    Stores the code of the error that occured.
  • connectionId (int)
    Stores the connection’s unique identifier.
  • hostId (int)
    Stores the transport level host ID of the connection.
  • address (string)
    Stores the IP address associated with the connection.

Example

This start type can be used to do server side setups or a client counter. Use a Change Variables node to change variables.

Server Ready

Started on the server when a client is ready.

Local Start Variables

This start type will automatically initialize the following local variables.

  • isReady (bool)
    Stores if the connection is set ready or not.
  • connectionId (int)
    Stores the connection’s unique identifier.
  • hostId (int)
    Stores the transport level host ID of the connection.
  • address (string)
    Stores the IP address associated with the connection.

Example

This start type can be used to do server side setups or a client counter. Use a Change Variables node to change variables.

Server Remove Player

Started on the server when a client removes a player.

Local Start Variables

This start type will automatically initialize the following local variables.

  • isReady (bool)
    Stores if the connection is set ready or not.
  • playerControllerId (int)
    Stores the ID of the player controller, a client can have multiple local players.
  • connectionId (int)
    Stores the connection’s unique identifier.
  • hostId (int)
    Stores the transport level host ID of the connection.
  • address (string)
    Stores the IP address associated with the connection.

Example

This start type can be used to do server side setups or a player counter. Use a Change Variables node to change variables.

Server Scene Changed

Started on the server after a scene has been completely loaded, when the scene change was initiated by the server.

Example

This start type can be used set all connected clients to not be ready any longer. Use a Set Client Ready node to set clients not ready.

UNET Start Types

A network machine is started by UNET callback functions. These start types are used when starting or stopping a client or server.

Start Client

Started on the client when the client is started.

Example

This start type can be used to do client side setups. Use a Change Variables node to change variables.

Start Server

Started on the server when the server is started.

Example

This start type can be used to do server side setups. Use a Change Variables node to change variables.

Stop Client

Started on the client when the client is stopped.

Example

This start type can be used to do client side setups. Use a Change Variables node to change variables.

Stop Server

Started on the server when the server is stopped.

Example

This start type can be used to do server side setups. Use a Change Variables node to change variables.

RagNet Start Types (soon deprecated)

A network machine is started by network callback functions. These start types are used by Unity’s old RakNet networking system and will soon be deprecated (as the whole system will be in Unity).

Connected To Server

Started on the client when successfully connected to a server. It’s implemented in the component’s OnConnectedToServer function.

Example

This start type can be used to load a scene after connecting to a server. Use a Load Scene node to load a scene.

Disconnected From Server

Started on the client when disconnected from a server. It’s implemented in the component’s OnDisconnectedFromServer function.

Additional Start Conditions

The Disconnected From Server start type can optionally be limited by checking the disconnection type. This can be used to only start the machine e.g. when the connection was lost, not when it was disconnected.

Example

This start type can be used to load a scene after connecting to losing connection to the server. Use a Load Scene node to load a scene.

Failed To Connect

Started on the client when a connection attempt to the server failed. It’s implemented in the component’s OnFailedToConnect function. This can be optionally limited to connection attempts to a master server.

Additional Start Conditions

The Failed To Connect start type can optionally be limited by checking the connection error. This can be used to only start the machine e.g. when the connection failed because of an invalid password.

Example

This start type can be used to display information why the connection failed. Use a Show Dialogue node to display a dialogue, or a Call HUD node to display a HUD.

Master Server Event

Started on clients and servers when reporting events from a master server. It’s implemented in the component’s OnMasterServerEvent function.

Additional Start Conditions

The Master Server Event start type can optionally be limited by checking the master server event type. This can be used to only start the machine e.g. when the registration succeeded.

Example

This start type can be used to display information about the master server event. Use a Show Dialogue node to display a dialogue, or a Call HUD node to display a HUD.

Network Instantiate

Started on objects that have been network instantiated (using Network.Instantiate). It’s implemented in the component’s OnNetworkInstantiate function.

Example

This start type can be used to do additional setup for network instantiated objects. E.g. use an Add Component node to add another component to the game object.

Player Connected

Started on the server when a new player has successfully connected. It’s implemented in the component’s OnPlayerConnected function.

Local Start Variables

This start type will automatically initialize the following local variables.

  • externalPort (int)
    Stores the external port of the network interface.
  • port (int)
    Stores the port of the player.
  • externalIP (string)
    Stores the external IP address of the network interface.
  • guid (string)
    Stores the GUID of the player.
  • ipAddress (string)
    Stores the IP address of the player.

Example

This start type can be used to do additional setup for a player on the server’s side. E.g. use a Call Function node to pass on the information to a 3rd party script.

Player Disconnected

Started on the server when a player has disconnected from the server. It’s implemented in the component’s OnPlayerDisconnected function.

Local Start Variables

This start type will automatically initialize the following local variables.

  • externalPort (int)
    Stores the external port of the network interface.
  • port (int)
    Stores the port of the player.
  • externalIP (string)
    Stores the external IP address of the network interface.
  • guid (string)
    Stores the GUID of the player.
  • ipAddress (string)
    Stores the IP address of the player.

Example

This start type can be used to do additional setup for a player on the server’s side. E.g. use a Call Function node to pass on the information to a 3rd party script.

Server Initialized

Started on the server whenever a Network.InitializeServer was invoked and has completed. It’s implemented in the component’s OnServerInitialized function.

Example

This start type can be used to do additional setup on the server after initialization. E.g. use a Call Function node to start 3rd party script functions.