Search Unity

Resolved Artificial latency not working for me

Discussion in 'Netcode for GameObjects' started by CosmoM, Feb 6, 2022.

  1. CosmoM

    CosmoM

    Joined:
    Oct 31, 2015
    Posts:
    204
    I'm trying to test the effect of latency by introducing artificial latency between my editor build and my development build on the same machine. In the editor I've set a 120ms delay in the Simulator Tools menu, and for the build I added the following in the NetworkManager's OnEnable (from the documentation):

    Code (CSharp):
    1. #if DEVELOPMENT_BUILD && !UNITY_EDITOR
    2. UnityTransport.ClientPacketDelayMs = 120;
    3. UnityTransport.ClientPacketJitterMs = 5;
    4. UnityTransport.ClientPacketDropRate = 3;
    5. #endif
    However, neither of these seems to be effective. When I test the latency by having the client send its localtime via ServerRpc, then back via ClientRpc and compare it to the current localtime, it shows that it only takes 10-20ms for a round-trip. What am I doing wrong?

    EDIT: Solved, turns out I was using UNet Transport instead of Unity Transport.
     
    Last edited: Feb 8, 2022