Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

[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.