Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

  2. Unity 2022.1 is now available as the latest Tech release.
    Dismiss Notice
  3. Improve your project's performance with our new guide on profiling in Unity.
    Dismiss Notice

Help Wanted Empty network variable on some clients

Discussion in 'Netcode for GameObjects' started by Kjalarr, Jan 18, 2022.

  1. Kjalarr


    Oct 19, 2018
    I'm building a cross platform multiplayer app to run on desktop, VR and Android (with Augmented Reality - AR Foundation). During a multiplayer session (using a dedicated server), any player can click a button to spawn a prefab - I'm only sending an int variable through a server rpc and then all the clients should spawn a prefab corresponding to their platform, based on that variable. The prefab is taken from Resources.

    I'm having a weird issue which is happening only on mobile version - when I'm in an active online session, and another player spawns a new prefab, the int variable I get on mobile is always 0, like the network variable is never getting updated. It works fine when I spawn prefab as an owner on mobile, and it's reflected correctly on other clients, regardless of platform.
    It also works fine in any platform combination, the bug doesn't exist on PC-PC, PC-VR, VR-Desktop, and everything looks fine in server logs.

    All platforms share the same code and at this point I'm starting to think this is some kind of netcode bug with variable synchronization. Has anyone encountered a similar issue?