Search Unity

  1. We have added dedicated sub-forums for UNet, the experimental MLAPI and Unity Transport Package. Please use the new forums to discuss related topics.
    Dismiss Notice
  2. How can our website serve you better? Give us your feedback. Take our survey and let us know.
    Dismiss Notice

Unity Multiplayer Sending input over the network, press is somehow arriving faster than release.

Discussion in 'Multiplayer' started by FoxCastz, Jan 9, 2021.

  1. FoxCastz

    FoxCastz

    Joined:
    Jun 18, 2015
    Posts:
    75
    I have these two functions, CmdForward and RpcForward, you can view them here(like 6 lines of code):
    Code (CSharp):
    1. [Command(channel = 3)]
    2.     void CmdForward(int newForward) {
    3.         RpcForward(newForward);
    4.     }
    5.     [ClientRpc(channel = 3)]
    6.     void RpcForward(int newForward) {
    7.         if(!isLocalPlayer) {
    8.             forwardSync = newForward;
    9.             forward = newForward;
    10.         }
    11.     }
    (channel = 3) is set to Unreliable Sequenced When I press W forward is set to 1 on the clients almost instantly, but when I release W which uses the exact same function to set forward to 0, there is a long delay before 0 is set. If I hold forward for around 2 or more seconds before releasing, then the release message is received instantly like the initial send.
     
  2. FoxCastz

    FoxCastz

    Joined:
    Jun 18, 2015
    Posts:
    75
    I've been at this issue for 10+ hours and solved it and am happy I solved it, but upset at how simple the solution was.
    CustomNetworkManager.maxDelay...that is all
     
    BetaMark likes this.
  3. BetaMark

    BetaMark

    Joined:
    Sep 27, 2014
    Posts:
    98
    I googled around for a minute to see why this was happening (for my own education) and I can only see CustomNetworkManager as part of Unity's deprecated UNet. Are you building a new game on top of Unet or is this class also in one of the other frameworks?
     
unityunity