Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Network C#: NavMeshAgent desyncs on client side; Server unit wobbles, client unit okay

Discussion in 'Scripting' started by asperatology, May 28, 2015.

  1. asperatology

    asperatology

    Joined:
    Mar 10, 2015
    Posts:
    981
    I am currently working to get a sphere unit to spawn correctly on both the server and the client. By correctly, I mean that the unit is instantiated in a way that doesn't break when the unit is spawned in, regardless of which side the unit is spawned in (server or client side). The unit spawned in has a navigation mesh agent as a component, therefore its exact location is constantly updated.

    So far, when a unit is spawned into the scene on the client side, both the server and the client shows the unit correctly. The main issue I have with the implementation is when the client moves the unit, the server side unit wobbles towards its original position and towards its new position, back and forth. Once both the server side and the client side units reach its intended destination, the server side unit then moves back to its original position, while the client side unit stays at the intended position, causing desync issues. This doesn't happen the other way around; server side unit moves to location, client side unit follows, and nothing is wrong.

    I don't know how to fix this one-sided issue. Any tips on how to fix this? Thanks in advance.