How do I debug a disconnect before OnSyncedStart()?

I am using TrueSync and if I have 2 players attached to the game, with 1 player controllable unit, both clients can watch just fine. However, if I have 2 player controllable units in the game, the message 'clients stopped sending input - disconnected' triggers before the level finishes loading and OnSyncedStart() is called.

I don't even know where to begin debugging this issue. Where should I start?


  • This is all of the information I can seem to get. It happens instantly upon OnSynchedStart that the drop is detected and the other player is gone.

    On SynchedStart
    UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
    UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    UnityEngine.Logger:Log(LogType, Object, Object)
    UnityEngine.Debug:Log(Object, Object)
    MovableUnit:OnSyncedStart() (at Z:\Projects\Atomech\project-sidescroller\Assets\Scripts\Shared\Movement\MovableUnit.cs:288)
    TrueSync.TrueSyncManagedBehaviour:OnGameStarted(List`1, Dictionary`2)
    TrueSync.TrueSyncManager:OnGameStarted() (at Z:\Projects\Atomech\project-sidescroller\Assets\Standard Assets\TrueSync\Unity\TrueSyncManager.cs:865)
    TrueSync.AbstractLockstep:OnEventDataReceived(Byte, Object)
    TrueSync.c__AnonStorey0:<>m__0(Byte, Object, Int32) (at Z:\Projects\Atomech\project-sidescroller\Assets\Standard Assets\TrueSync\Unity\PhotonTrueSyncCommunicator.cs:43)
    NetworkingPeer:OnEvent(EventData) (at Z:\Projects\Atomech\project-sidescroller\Assets\Standard Assets\PhotonNetwork\NetworkingPeer.cs:2606)
    PhotonHandler:Update() (at Z:\Projects\Atomech\project-sidescroller\Assets\Standard Assets\PhotonNetwork\PhotonHandler.cs:157)

    (Filename: Z:/Projects/Atomech/project-sidescroller/Assets/Scripts/Shared/Movement/MovableUnit.cs Line: 288)

    Player dropped (stopped sending input)
    UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
    UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    UnityEngine.Logger:Log(LogType, Object)
    TrueSync.TrueSyncManager:FixedUpdate() (at Z:\Projects\Atomech\project-sidescroller\Assets\Standard Assets\TrueSync\Unity\TrueSyncManager.cs:724)
  • Xelnath
    edited July 2017
    Even weirder, tonight it just started working, then broke again a few minutes later without code changes. While it was working, I was able to record a video. The UI at the top shows the synchronized inputs, recorded on the same machine.


    I know the later on assertion errors need to be fixed, but how brittle is TrueSync expected to be? Should simple error logs ("loading default".. messages) be cause for desync?
  • Humm, can you share your MovableUnit.cs script?
  • Humm, maybe not the problem, but could you put "StateTracker.AddTracking(this);" in the OnSyncedStart? Well, besides that I suggest you to comment/disabled OnSyncedUpdate and/or collision code, to isolate which one of them cause a desync. The players will be still but if you enable a piece of code time by time you will find out what is triggering the desync.