Search Unity

Identifiy a Commands sender on a non player owned object

Discussion in 'Multiplayer' started by pojoih, Jul 17, 2015.

  1. pojoih

    pojoih

    Joined:
    Mar 30, 2013
    Posts:
    226
    Topic says pretty much everything. From what I've understand you can't change authority on an object at runtime and a client cannot be authoritive one more than one object.

    I have a Poolmanager with several server-spawned missiles. I want the player on which the missile is targeted to update the missile position and rotation to make it fair for him :).

    Therefore I have to identify him to send him AND ONLY HIM the command with the transform infos to update it on the server and have it spread from there on via ClientRPC. But I did not found a way to identify the targeted player. HasAuthority or IsLocalPlayer does not work since the missile is not a player controlled object.
    Is there a way to identify the shooting player and store it in the missile?
     
    Last edited: Jul 17, 2015
  2. Palimon

    Palimon

    Joined:
    Apr 18, 2013
    Posts:
    225
    Does the missile have a target when spawned on the server? I assume it must based on your description. Just add a class variable on the missile to hold the target player.
     
  3. HugoZandel

    HugoZandel

    Joined:
    Mar 11, 2014
    Posts:
    52
    I'm also interested in getting the sender on a non player owned object.