Search Unity

How to use NetworkPlayer

Discussion in 'Connected Games' started by LukeB, Aug 28, 2009.

  1. LukeB

    LukeB

    Joined:
    Aug 8, 2009
    Posts:
    88
    Hey everyone!
    I have been looking around the forums for ages and can't find how the NetworkPlayer class should be used. Both the scripting reference and manual aren't exactly very detailed in it either!

    A game client has connected to a network. I would then like it to send its 'NetworkPlayer' information in an RPC. Attempting to use RPC("function",RPCMode.Server,name,NetworkPlayer); doesn't work and results in failure to send the RPC (with 'function' having the parameters (name:String,player:NetworkPlayer) ). Can anyone help out? :)
    Thanks!

    P.S: I would reccommend adding more detail into the scripting reference, as 'The NetworkPlayer is a data structure with which you can locate another player over the network.' isn't exactly as informative as it could be :p
     
  2. AngryAnt

    AngryAnt

    Keyboard Operator Moderator

    Joined:
    Oct 25, 2005
    Posts:
    3,042
    Hey Luke

    It would be a lot easier to identify your issue if you would post some of the relevant code in this thread. Note that clicking the "Code" button just below the subject line of a reply lets you add in code tags which formats your script so that it is easier to read.
     
  3. LukeB

    LukeB

    Joined:
    Aug 8, 2009
    Posts:
    88
    Hey AngryAnt - Thanks for your reply :)

    I've managed to be a little silly and forget all about 'Network.player' (before I was attempting to send 'NetworkPlayer' as a param in an RPC, which obviously wouldn't work. That's now been changed to 'Network.player', making it work correctly :)).