Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Scale And Position Values Are Changing For UI Object On Client Start

Discussion in 'Netcode for GameObjects' started by kayusoft, Aug 6, 2023.

  1. kayusoft


    Mar 22, 2014
    I try to make an online TicTacToe game.
    I made my gameboard with UI elements like panels and buttons.
    My NetworkObject and other NetworkBehaviour components are on an UI panel.
    I don't spawn any network prefab.
    Everything is in the scene.
    I don't change any object's position or scale in my code.
    And my game is working as expected.
    I can connect to instances and play the game on network.
    But when i start one of the instances as client, my game board's (which has NetworkObject component) position and scale (it gets smaler) values change (only on client side).
    Also it doesn't have NetworkTransform component.
    Does anyone know anything about this issue?
  2. CodeSmile


    Apr 10, 2014
    UI should not be networked in any form whatsoever. There should not be a single NetworkAnything on the canvas or one of its children.

    You have the board game data, that‘s a 3x3 array most likely. That‘s the only data that needs to be synchronized. The UI can simply get a reference to that board data behaviour and update its state every frame (polling) or for more complex UI there would be events the UI can hook into.
    kayusoft likes this.
  3. kayusoft


    Mar 22, 2014
    Thank you CodeSmile.
    After seperating networking controllers from UI elements, I don't get any transformation issue now.
    It was an interesting bug though.