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

[solved] RPCcalls on prefabs in FPS

Discussion in 'Multiplayer' started by MikeHergaarden, Aug 23, 2008.

  1. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    I've got a problems with adding multiplayer to an FPS game.

    I've got prefabs for every new player. Moving fully works, using synchronisation, and rpc calls for user input (from the networking examples).

    But i've got a problem with adding multiplayer shooting.
    Everytime someone shoots, a fire call is send via an RPC.

    When I get two players in a game, the last player to join can shoot, and on the first players game he receives the shoot calls, so the shooting is fully working for the second player.

    However, the first player does shoot locally, but his Fire RPC's are never received by the second player.

    Adding a thirth player doesnt change much:
    Player 1 can see 2 firing, and can see 3 firing (and ofcourse himself).
    Player 2 can only see him/herself firing
    Player 3 can only see him/herself firing

    What am I missing here ?

    To send the rpc calls, I use "networkView.RPC("FireOneShot", RPCMode.All);". Doesn't the first player know about the second player and therefor is not included with "All" or so ?
     
  2. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    I've found it:

    They never got a networkview ID.

    I was assuming they'de get one automatically, but then discovered I was using Instantiate instead of network instantiate, which is why i need to assign them myself.