2
\$\begingroup\$

I have a client server scenario, just a player moving about on the client and he moves about on the server using the built in networking provided in Unity 5. I have my client scene running in the editor and was playing about with the Network Transform Script Values, more specifically the Network Send Rate. Setting this Value to 29 (its highest) the movement on the server is almost smooth. Setting this value to 1 and the movement on the server is very laggy as I expected. However, if I set the network send rate to 0 on the client, I expected it not to move at all on the server, but it moves and alot smoother than the value 29.

Why is it, that when the network send rate is set to 0 that my character still moves on the server?

\$\endgroup\$
  • \$\begingroup\$ Maybe 0 is not a valid value and is clipped to 1? \$\endgroup\$ – Panda Pajama Aug 24 '15 at 11:52
  • \$\begingroup\$ Nah i don't think so. When the value is at 1 the movement on the server is very choppy, but at 0 its very smooth, i thought it shouldn't be moving at 0, something else must be taking over. This happens from character movement, doesn't seem to affect objects. \$\endgroup\$ – CH99 Aug 24 '15 at 12:44
0
\$\begingroup\$

This might be because your movement script doesn't specify where to execute the code, so when you input something, the code is executed on the server.

Make sure your movement code has an if(isLocalPlayer) check:

private void Update()
{
     if (!isLocalPlayer) 
     { 
         return;
         //this checks if the code is not running on the local instance of the game
         // if it isn't, it stops executing what's next
     } 

     //Your Code here
}
| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.