Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Sync score across the network. Please help!

Discussion in 'Scripting' started by Red_Kay, Nov 9, 2015.

  1. Red_Kay

    Red_Kay

    Joined:
    Aug 14, 2015
    Posts:
    94
    Hello,

    I am making a top-down football 2D multiplayer game. When a player scores a goal I want to sync the score to all players in the network. I am completely a noob at networking and I am working with UNET. How should I go about this? The goal posts have a trigger which increments the goals (int).

    I searched here and there but didn't understand anything properly. I came across Network Identity but didn't understand it either.

    Please help!

    Thanks for your time :)
     
  2. Elmdran

    Elmdran

    Joined:
    Oct 28, 2014
    Posts:
    34
    I assume you have two clients connect, one being the host and the other connecting to the host.
    I made a multiplayer game before and I did it this way, I found it really bad for keeping good sync, as some things would register on my client but not on the other client and so on.

    After that I figured I would have a separate host, both players connect to that one, and instead of having your own players that you control on your client, you have both players on the server, and the clients you connect from only send in stuff to the players on the server, so both clients will see the exact same things, all physics events and colliders will work the same for you.

    I know it's not really the answer you wanted but you should look into it :)
     
  3. BenZed

    BenZed

    Joined:
    May 29, 2014
    Posts:
    524
    Do some tutorials:
    http://forum.unity3d.com/threads/un...torials-making-a-basic-survival-co-op.325692/