- Home /
uNet horrible lagg (even on local servers)
Hey there, my uNet has horrible lagg and I'm uncertain why this is happening. I believe it is because I have my Max Delay turned up, but if I turn my max delay down, then it starts to kick the players if they have high pings. Here's my lobby manager config:
The two main issues with the lagg is that 1. The players are extremely "teleporty", and this is fine on the client but on other people's screens, it looks like they're teleporting all over the place.
And 2. I have a bomb deploying script when a player presses the spacebar, and when he does it spawns a bomb on the server, but that is delayed by like 1.5 seconds and often times players end up blowing themselves up because of this delay. Could this be because it's a NetworkBehaviour script? If so, how do I handle this clientside and then spawn it on the server with much less delay?
public class DeployBomb : NetworkBehaviour {
public GameObject bombPrefab;
private float timeSinceLastPlace = 0f;
void Update () {
timeSinceLastPlace += Time.deltaTime;
if( Input.GetButtonDown( "PlaceBomb" ) && isLocalPlayer && !this.gameObject.GetComponent<LocalPlayerSetup>().isSpectating && timeSinceLastPlace >= 0.6f ) {
if( this.gameObject.GetComponent<LocalPlayerSetup>().currentBombs < this.gameObject.GetComponent<LocalPlayerSetup>().maxBombs ) {
CmdSpawnBomb( this.gameObject );
timeSinceLastPlace = 0;
}
}
}
}
Your answer
Follow this Question
Related Questions
UNET shouldn't disconnect 0 Answers
Networking lobby player image not working on host and other clients 0 Answers
UNET Display Connected Player Names inGame UI 0 Answers
How to create a matchmaking lobby 0 Answers