Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Bug Client Network Transform syncing unchecked axis

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

  1. yoavtc2004

    yoavtc2004

    Joined:
    Jan 17, 2023
    Posts:
    10
    Hi!

    I have a GameObject with the following line of code:
    Code (CSharp):
    1. transform.position = new Vector3(transform.position.x, transform.position.y, -5f);
    The GameObject also has the ClientNetworkTransform component attached to it. upload_2024-2-6_20-4-24.png

    This is a 2D game so the Z axis is unchecked. When I enter play mode, the Z axis of the GameObject is at 0 even though the script is supposed to force it to be -5.

    When I disable the ClientNetworkTransform component in runtime in the editor, then the Z is -5 but for some reason when its enabled, the Z is at 0.

    There is no other script that messes with the position of this GameObject. Just these.



    I would appreciate any help! Thanks :)
     
  2. NoelStephens_Unity

    NoelStephens_Unity

    Unity Technologies

    Joined:
    Feb 12, 2022
    Posts:
    285
    HI @yoavtc2004,

    Could you provide a bit more context of where that line of code is being invoked (i.e. in Awake, Update, Start, OnNetworkSpawn, etc) and on which component it is being invoked? It would help me determine what might be happening here.