Search Unity

Question Empty network variable on some clients

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

  1. Kjalarr

    Kjalarr

    Joined:
    Oct 19, 2018
    Posts:
    3
    Hi,
    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?