The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Lag when using either the Smooth Sync Movement or NetworkCharacter script. How do I get rid of lag?

2018-01-27 01:05:40

I'm trying to eliminate the lag or at least smooth the movements so the lag is not visible but I'm having difficulty. I've played around with the settings on the PhotonView and Photon Transform View as well as the SmoothSyncMovement script below that I attached to my player object but I've had no luck with reducing the lag.

I'm using the Photon Cloud server and not an on-premise local server.
The player game objects that I'm trying to sync across the network are also using Rigidbody.Addforce for player movement. Could this be a factor causing the lag?

What am I missing and doing wrong?

Thanks community,

[RequireComponent(typeof(PhotonView))] public class SmoothSyncMovement : Photon.MonoBehaviour, IPunObservable { public float SmoothingDelay = 5; public void Awake() { bool observed = false; foreach (Component observedComponent in this.photonView.ObservedComponents) { if (observedComponent == this) { observed = true; break; } } if (!observed) { Debug.LogWarning(this + " is not observed by this object's photonView! OnPhotonSerializeView() in this class won't be used."); } }



[Deleted User]
2018-02-01 14:16:58

Hi @Sfoxx28,

without any modification this is 'normal' behaviour and caused by the delay the message needs to 'travel' from one client across the server to another client. If you want to you can take a look at the discussion here which is about the same topic.

In short: the sender can send an additional information which can be used by the receiver in order to try to predict the movement of the object. This way you won't get rid of lag either, but you can lower its occurrence. A documentation page about this topic will be available in the next days / weeks, there is currently no exact ETA about this.

If you have further questions, please feel free to ask.

Back to top