Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question I'm Confused with Netcode for GameObjects (Multiplayer)

Discussion in 'Netcode for GameObjects' started by Wijari, Dec 3, 2023.

  1. Wijari

    Wijari

    Joined:
    Dec 3, 2018
    Posts:
    1
    Hello, I have been trying to follow Unity tutorials to create a multiplayer game using "Netcode for GameObjects." Unfortunately, I don't understand everything they explain because I don't speak English. (This is translated with Chat GPT.) Everything is working well locally, but I got lost in the "Game Server Hosting (Multiplay)" part. Here's what I did:

    - Imported Multiplay with the Package Manager.

    - Linked the project with Services in Project Settings.

    - Compiled the project for Linux.

    - Created the build on the Dashboard and uploaded the files.

    - Created Build Configurations.

    - Created Fleets in the South America region (currently showing Online status).

    - In Servers, I chose a server and started it.

    In the project, I have buttons 'Server,' 'Host,' 'Client,' and as clients join, only a cube with a different color appears.

    Questions:

    1. How do I make the build I uploaded to the Dashboard automatically establish itself as a server? Is it okay to do it from a Start() or Awake()?

    2. What should I change in my project to connect to the server I enabled on the Dashboard and not continue working locally?
    Thank you!
     
  2. RikuTheFuffs-U

    RikuTheFuffs-U

    Unity Technologies

    Joined:
    Feb 20, 2020
    Posts:
    437
    Hi @Wijari ,
    Yes, there are different ways to do this. I'd recommend to check the official Small Scale Competitive Multiplayer template that you can install from the Unity Hub for Unity 2022.3, as it implements a "Bootstrapper" that does exactly this.

    Clients connect to Multiplay servers through a matchmaker, so you need to implement the matchmaker. (this is also displayed in the template I mentioned).

    Does this help?