Search Unity

Suggestions on troubleshooting "Did not find target for sync message"

Discussion in 'Multiplayer' started by yoHasse, Apr 19, 2018.

  1. yoHasse

    yoHasse

    Joined:
    Jul 22, 2016
    Posts:
    15
    "Did not find target for sync message for..."

    This is a horrible message to receive because it basically doesn't tell you anything. Except for saying you messed up somewhere in your network code. I get these when hosting on the built game and running client in unity program. And I've spent hours looking for causes of these, always managed to find them but it's still hours spent on debugging instead of building.

    Anyway, here's a few tips on what you can look for when encountering this warning.
    If you have any tips on your own please don't hesitate to share them.
    • The error is usually caused by a client or server trying to sync or call a function that is not active on that client or server.
      • ClientRpc -> Trying to call client version of the object to run the script.
      • SyncVar, SyncList, SyncEvent -> Trying to sync to client version of the script
    What to look for:
    1. Do you have any "Server Only" GameObjects ?
      • Check for SyncList variables - Change them to ordinary list instead.
      • Check for any ClientRpc, SyncVar, SyncEvents attributes. Remove these.
        • Why changing or removing these? A server only gameobject has nothing to sync to because that object will be disabled on the client.
    2. Look at the error, what does it say? "...target for sync message..." or "SyncEvent" or maybe "SyncList"
      • These can get you a general direction on where to look. Have you a SyncList variable getting called on a ServerOnly object?
    3. If you for some reason destroy object on client side only.
      • Does the destroyed object have any of the ClientRpc, syncvar, events etc. mentioned above? Then the other non-destroyed object will try to sync to this object but won't find anything.
    WIP...
     

    Attached Files:

    warrencwwong, Che4Cuba and N7D like this.
  2. DaB0yz

    DaB0yz

    Joined:
    Dec 23, 2021
    Posts:
    1
    Man you're a legend. I've spent ages trying to figure out why I'm getting this error because I didn't realise that my game manager object was server only. Thanks.
     
  3. RikuTheFuffs-U

    RikuTheFuffs-U

    Unity Technologies

    Joined:
    Feb 20, 2020
    Posts:
    440
    Thanks for sharing these tips! I'll try to have them added in the official documentation :D
     
  4. RikuTheFuffs-U

    RikuTheFuffs-U

    Unity Technologies

    Joined:
    Feb 20, 2020
    Posts:
    440
    Hey @yoHasse , just to confirm my understanding: are you using Netcode For Gameobjects or some other multiplayer framework?