Skip to main content

Your First Networked Game "Hello World"

This "Hello World" guide walks you through creating a project, installing the MLAPI package, and creating the basic components for your first networked game.

Create a new project in Unity#

  1. Open the Unity Hub.
  2. Click New.
  3. Select type ā€˜3Dā€™
  4. Rename the project "Hello World".
  5. Select the location to save the project.

This tutorial requires an MLAPI-supported version of Unity (2019.4+).

Open Unity create new project

Import MLAPI Package via URL#

See the Install MLAPI guide to install the MLAPI package.

Create the Basic Components#

  1. Right click in the Hierarchy tab of the Main Unity Window.

  2. Select Create Empty.

  3. Rename the GameObject NetworkManager.

    create gameobject


    We renamed the GameObject because:

    • It makes it easier to refer to later.
    • There is one and only one NetworkManager, this is the object that contains the NetworkManager component.

    You have now created a new GameObject called NetworkManager.

  4. Select NetworkManager.

  5. Click Add Component in the Inspector Tab.

  6. Select MLAPI from the list shown.

  7. Select NetworkManager Component from the list displayed.

  8. Inside the NetworkManager component tab, locate the NetworkTransport field.

  9. Click "Select Transport".

  10. Select UnetTransport.


  11. Create 3D Object->Capsule (name it Player).

  12. Add a NetworkObject component.

  13. Click the Assets folder.

  14. Create a new Folder and call it Prefabs.

  15. Make Player a prefab by dragging it to Prefabs folder you just created.

    createplayer prefab

  16. Delete Player from scene.


    We remove Player, because we will be using the network library to spawn the player. The library cannot track objects that start in the scene.

  17. Add Player prefab to NetworkPrefabs list inside of NetworkManager.

  18. Select Default Player Prefab.



    When you select the Default Player Prefab , you are telling the library that when a client connect to the game, automatically spawn this prefab as the character for the connecting client. If you do not have the default selected for any prefab the game will crash on client connect.


    You may see the following error reported There is no NetworkPrefab Marked as a PlayerPrefab. Once you have completed the above steps you can clear the error.

  19. Create a 3D Object->Plane, centered at (0,0,0).

  20. Click Play.

  21. Click Start Host under NetworkManager.



Congratulations you have created a networked game. It is not a very flashy game but it is a networked game nonetheless. For the next steps in your journey see Building on "Hello World"