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. Unity 2022.2 is now available as the latest Tech release.
    Dismiss Notice
  3. We are making some changes to the DOTS forums.
    Dismiss Notice
  4. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Network Object not syncing

Discussion in 'Multiplayer' started by chukwuboy88, Nov 24, 2022.

  1. chukwuboy88

    chukwuboy88

    Joined:
    Apr 22, 2022
    Posts:
    10


    Do anyone know why my client network object isnt syncing with the host, i have racking my brain over the past few days , any help will be needed.

    The ball position is being updated by the capsule, the capsule movement isnt behaving like that and i have no idea why.
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    1,643
    Is the issue that the ball is lagging behind the player figure?

    If so that‘s called lag. ;)

    Presumably the player is client authoratative, meaning its position is updated instantly whereas the ball seems server authoratative meaning its position lags one RTT behind because the position has to be transferred from server to client first.

    If that‘s not the issue then please provide more info.
     
  3. chukwuboy88

    chukwuboy88

    Joined:
    Apr 22, 2022
    Posts:
    10
    Yeah that's the issue. I put in a client network transform on the ball I don't know why it's still behaving like that.
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    1,643
    Do both player and ball have a client-authoritative network transform?
    Is the ball with physics enabled (NetworkRigidbody)? If so, its physics behaviour will be simulated on the server.
     
  5. chukwuboy88

    chukwuboy88

    Joined:
    Apr 22, 2022
    Posts:
    10
    I don't know how else to make it client authoritative.
     
  6. chukwuboy88

    chukwuboy88

    Joined:
    Apr 22, 2022
    Posts:
    10
    Ok I will send a more comprehensive guide to how it all works so you can better understand the situation.
     
  7. chukwuboy88

    chukwuboy88

    Joined:
    Apr 22, 2022
    Posts:
    10
    Code (CSharp):
    1.  
    2.  
    3.     public void Update()
    4.     {
    5.         //if (GameManager.instance.gameActive)
    6.         //{
    7.         if (_player.user && _player.hasPossession)
    8.         {
    9.             var ballposition = gameObject.transform.position;
    10.             Ball.instance.transform.position = new Vector3(
    11.                 ballposition.x,
    12.                 ballposition.y - 0.47f,
    13.                 ballposition.z + 1.14f);
    14.         }
    15.  
    16. }
    17.  

    This is The code on the player that updates the position of the ball.
     
  8. chukwuboy88

    chukwuboy88

    Joined:
    Apr 22, 2022
    Posts:
    10
    And this the inspector for the ball object.
     

    Attached Files:

  9. RikuTheFuffs-U

    RikuTheFuffs-U

    Unity Technologies

    Joined:
    Feb 20, 2020
    Posts:
    114
    Hi @chukwuboy88 , I'm not sure I udnerstood the issue. By looking at the video everything seems to be moving.
    What is supposed to happen that it's not happening?
     
  10. Cranom

    Cranom

    Joined:
    Jan 31, 2018
    Posts:
    26
    You probably mistook the stadium for an arena, the soccer player for a slave, and the ball for a boulder chained to his ankle. But it is actually a soccer game, and generally the ball is held before the player dribbling and not behind ^^.
    That's kind of an interesting miss by the way, isn'it ? Someone from unity not seing the obvious issue at hand, the issue being one of the most problematic subject of networking, being timing.
     
  11. chukwuboy88

    chukwuboy88

    Joined:
    Apr 22, 2022
    Posts:
    10
    Is there anything I can do to get around this.