Search Unity

Who called the command?

Discussion in 'Multiplayer' started by Sander1991, Aug 3, 2016.

  1. Sander1991

    Sander1991

    Joined:
    Aug 25, 2014
    Posts:
    162
    Is it possible to get something like an ID, when a player called a command? My players are allowed to press a button and I need to know who pressed the button. Both players are at the moment allowed to click on it. Is it possible to get something like a networkID, who called the command?

    Thanks in advance.
     
  2. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    You could send the player's netId or GameObject as one of the Command's parameters
     
  3. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    then you could try sending a message instead of a Command. You can access the NetworkConnection in the NetworkMessage you get in the message handler function

    Though I really don't know what kind of problem sending parameters through Commands could cause
     
  4. DamonJager

    DamonJager

    Joined:
    Jul 16, 2015
    Posts:
    56
    I'm new, but, I can say that sendind through a parameter doesn't look secure at all. Confirm pls.