Search Unity

Bug Unity Netcode with Relay not syncing correctly

Discussion in 'Multiplayer' started by HelloThere65, Jan 18, 2024.

  1. HelloThere65

    HelloThere65

    Joined:
    Aug 23, 2022
    Posts:
    13
    Hello all,

    I'm new with using netcode, relay and C#, and I'm having multiple errors with how it syncs, and also my code is very bad. Now, this is quite a big issue as i am quite far into my prototype, and i have added a lot of things (and completely forgetting this is a multiplayer game). Here is a video showing everything that isn't working at all:


    As you could see, the enemy healthbar isn't synced (i have a network transform), the animations don't sync, and i have the network animator, and any instantiated objects (which i forgot to show in the video) don't sync in any way. Also, if the enemy is dead on the host, the animation of it dead plays on the client, but it still does damage to the client if you go near it. And, to add to this, the healthbar on the client dont show.

    Also i am now realising that screen recording on a windows doesn't show the background stuff (i had the Host, which had everything perfect on it). In single player, the animations would work.

    Thanks in advance for anything fixed :)
     
  2. HelloThere65

    HelloThere65

    Joined:
    Aug 23, 2022
    Posts:
    13
    Forgot to mention in the above comment, my code is very bad, and it is very long for the enemy, combat logic and the player controller. The player controller is the only networkbehaviour, and because those three scripts are very long, i will send the snippets needed. For example, my combat + enemy controllers are 450 lines and my player script is 350