NetworkRunner.Spawn() doesn't spawns the object when client calls it

Options

Client when do NetworkRunner.Spawn() the object gets destroyed instantly 

but when Host does the same the object is synced properly

What Am I missing?

Sample project works fine

Best Answer

  • BinkyYoo
    BinkyYoo
    Answer ✓
    Options

    If you are starting the game in hosted mode, than I'm pretty sure this is intended. Clients can send in input to the server, but the server is the one that spawns and keeps track of Network objects.


    Basically, clients dont actually have authority over network objects (known as state authority). It can only send Input (because they have input authority instead) and that input goes through to the Host player automatically, is processed, and sent back to the client to confirm.


    In shared mode, clients can spawn in their own networkobjects and other players will spawn in proxies, but this is a different way to handle networking

Answers

  • BinkyYoo
    BinkyYoo
    Answer ✓
    Options

    If you are starting the game in hosted mode, than I'm pretty sure this is intended. Clients can send in input to the server, but the server is the one that spawns and keeps track of Network objects.


    Basically, clients dont actually have authority over network objects (known as state authority). It can only send Input (because they have input authority instead) and that input goes through to the Host player automatically, is processed, and sent back to the client to confirm.


    In shared mode, clients can spawn in their own networkobjects and other players will spawn in proxies, but this is a different way to handle networking

  • BinkyYoo
    BinkyYoo
    edited April 2022
    Options

    Also, the OnPlayerJoined and OnPlayerleft methods from INetworkRunnerCallbacks are only called if the player is host, so thats why you can call Spawn() on those methods and it will work correctly