Search Unity

Resolved Inconsistent positioning between build and editor with Netcode For GameObjects

Discussion in 'Netcode for GameObjects' started by yoavtc2004, Feb 6, 2024.

  1. yoavtc2004

    yoavtc2004

    Joined:
    Jan 17, 2023
    Posts:
    10
    Hi! When I build my game and test it as host is unity editor and connected client is a build, on the client side both of my character's Z axis is -5 (Like I want them to be)

    But on the host's side, the connected client's Z axis is 0.

    This changes though if I connect to the host via another instance of the Unity editor, so it seems like the problem is only when the connected client is a build.

    This is weird to me because as I said it works when testing with two editors, but not when testing with an editor and a build. Seems to be some inconsistency with the build whether its somehow in my code (Didn't write anything specific that changes between build and editor)

    Help would be appreciated! Thanks :)

    PS, if something is unclear please tell me and I'll try to rephrase it better.


    EDIT: Found the bug, the network manager spawned the prefabs on 0, 0, 0. and since I wasnt syncing the Z axis and even if I was, it didn't get updated, then the transform of a client from the view of another client was still on 0 on the Z axis since there wasn't an update sent.
     
    Last edited: Feb 6, 2024