Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

PlayerContollerID in 'create player' callbacks is always 0

Discussion in 'Multiplayer' started by powdered_swords, Jul 9, 2015.

  1. powdered_swords

    powdered_swords

    Joined:
    Mar 11, 2013
    Posts:
    28
    I hope I'm not misinterpreting the purpose of playerControllerID, however I've noticed a difference between manually spawn objects and player objects.

    When spawning manually I've found the playerControllerID value corresponds correctly to the relevant connection id. In comparison, automatically spawned player objects on both LobbyManagers and NetworkManagers will always have the value set to zero.

    Is this intentional? If so how can I tell which player object corresponds to which player?
     
  2. powdered_swords

    powdered_swords

    Joined:
    Mar 11, 2013
    Posts:
    28
    Ok it turns out I was misinterpreting some details about playerControllerID. I'm now aware that this value is used to distinguish different players on a single connection. However i'm still left wondering how can I determine which connection has the authority over a NetworkIdentity.
     
  3. DrHeinous

    DrHeinous

    Joined:
    Jun 25, 2013
    Posts:
    19
    I have much the same question. Say, the server spawns five objects. I'd like player A to be able to control three of them, B to control two.

    My initial thought is, while spawning them to have an 'owning player id' field on them. That way you can easily find what player A or B can select or control (either on the client or server). But I'm not sure how or where to get the unique id for a player.