Search Unity

How to sync transform of large no. of gameobjects

Discussion in 'Netcode for GameObjects' started by Kadir-, Oct 30, 2021.

  1. Kadir-

    Kadir-

    Joined:
    Mar 24, 2020
    Posts:
    14
    I am making a snake multiplayer game for android. The snake got many body parts. Something like this:


    Each body parts have its own Network Transform to sync position and rotation. The problem is when the snake grows its body parts FPS drops down drastically. I used the profiler and found the problem is with the network transform.
    https://ibb.co/tX9gYLd

    So, in short how to sync positions of 200 gameObjects.
     
  2. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    From the profiler picture, it seems to be GUI related, not the syncing.
    Maybe when expanded it'll show syncing taking up the cost? I don't really use Netcode for game objects.

    If it is the transform syncing cost, maybe refactor it so each head doesn't need it's own syncing.

    As far as I know, Netcode for game objects transform syncing performance isn't too good. Although I remember a pull merged a while ago that made improvements to it's performance.
    So i don't know how good it is currently compared to before.
     
    Kadir- likes this.
  3. Kadir-

    Kadir-

    Joined:
    Mar 24, 2020
    Posts:
    14

    I fixed it by including only one NetworkTransform at head and letting the other tail parts follow the head through script