Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Network Transform not working if SyncVar present in code

Discussion in 'Scripting' started by swat3d, Jan 13, 2019.

  1. swat3d

    swat3d

    Joined:
    Jul 19, 2013
    Posts:
    7
    Hey,

    So it seems like in 2018.3.0f1, the network transform (RigidBody 3D) from the host to the remote client doesn’t work if there is any field with the SyncVar attribute on it, even if it’s just declared and not used at all and regardless of the type.

    The transform is sent from the remote client to the host but not the other way around.

    I’ve tried the exact same basic test in 2018.2.18f1 and works fine.

    Has anyone seen the same thing?

    I’m on Mac btw.
     
    Last edited: Jan 13, 2019
  2. swat3d

    swat3d

    Joined:
    Jul 19, 2013
    Posts:
    7
    Ok so it seems like you need to have the network identity and network transform components at the top of the stack. It's working now.
    This has been mentioned in previous posts but the solution was to move them to the bottom of the stack, in my case it's the opposite.
     
  3. AmazedEvil

    AmazedEvil

    Joined:
    Sep 14, 2014
    Posts:
    6
    Having same issue! Moving NetworkTranform down solved some issues, but in some cases odd behaviour is still there, so I guess only real fix can be used for sure. Does anybody can submit issue with not free version? As I can see - submitting ones from personal one doesn't have much effect.
     
  4. AmazedEvil

    AmazedEvil

    Joined:
    Sep 14, 2014
    Posts:
    6
    Seems to be something about code generation, since I removed OnDeserialize with just calling base.OnDeserialize, issue went away.
     
  5. swat3d

    swat3d

    Joined:
    Jul 19, 2013
    Posts:
    7
    So you mean overriding OnDeserialize in your NetwoekBehaviors and just calling base.OnDeserialize?

    There is definitely a bug in there with SyncVar and Network Transform. Still present in the latest 2018.3. I can see either sync vars or network transform stop working depending on the order of components in the stack.
     
  6. mahewitt

    mahewitt

    Joined:
    Mar 19, 2014
    Posts:
    279
    Did you find a fix for this? Same issue here - as soon as I combine Network Transform with a NetworkBehaviour containing a SyncVar the Network Transform stops working.
     
  7. swat3d

    swat3d

    Joined:
    Jul 19, 2013
    Posts:
    7
    No. It’s just broken...
     
  8. AmazedEvil

    AmazedEvil

    Joined:
    Sep 14, 2014
    Posts:
    6
    I've somehow made both work together, only to find out that issue is still with me, but only firing on OS X (originally I've been working on Windows), that's a hell of a problem... What I've been doing to solve the case - I've compiled my own Networking and replaced original with it and added aditional logging to see who is eating bits on deserializing and who is writing them on serializing, that's how I found broken component in the first place, maybe it's an option for anybody else
     
  9. AmazedEvil

    AmazedEvil

    Joined:
    Sep 14, 2014
    Posts:
    6
    After disassembling original Unity Networking dll, I think I've found part that causes this issue, funny thing is that 2018.3 branch doesn't have this issue, so you can build it by yourself and don't worry. Mechanics of this issue is: on serializing, we make separate messages for every channel, components are writing to message one by one, even (!) if they use other channel then one we're writing now (usualy, in that case they are writing zero byte). Fix that were made in 2018.3 (and not uploaded to bucket repo) is to skip components using other channel... but only in deserializing! So NetworkTransform is eating zero byte written by some SyncVar having component (NetworkTransform using unreliable channel, while syncvar usually using relialbe) and thinks that nothing changed. Briliant. Hope someone can make a bug report out of it, cause I'm too tired of this S*** for now (besides, they're already processing my other issue and I haven't heared anything from them for month).
     
  10. AAK_Lebanon

    AAK_Lebanon

    Joined:
    May 30, 2015
    Posts:
    77
    I have exactly the same issue on 2018.3.0f2 and I hope that there is a workaround or a fix ...
     
  11. UPlayOnline

    UPlayOnline

    Joined:
    Oct 31, 2014
    Posts:
    8
    At least, on version 2018.3.9f1 is fixed.
     
    AAK_Lebanon likes this.