Search Unity

How to assign authority for objects in scene

Discussion in 'Multiplayer' started by Staggan, Aug 3, 2017.

  1. Staggan

    Staggan

    Joined:
    Jul 9, 2015
    Posts:
    10
    Hello

    The question has been asked before, but as a newbie, I must be missing something.

    I have a scene that has an object within it... an object that any player can pickup and walk around with... and drop at any time.

    This object has a network identity, a network transform and is set to local player authority in the network identity.

    However, only the host acting as the server appears to be able to control this object, the other clients can pick the object up but cannot do anything else with it...

    I have tried to spawn the object into the scene, but when I do this NONE of the players can do anything other than pick up the object..

    What am I missing?

    Thanks
     
  2. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Why does it have LocalPlayerAuthority? Seems like you want noone to have authority over it?
     
  3. Staggan

    Staggan

    Joined:
    Jul 9, 2015
    Posts:
    10
    Hello

    The object starts in the scene... when a player grabs that object I need them to be able to do things with it... so when they collide with it I parent it to them and they can move around with it.. this works fine.

    When I then try to drop it, or throw it, or something like that, nothing happens...

    Thanks
     
  4. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Well, if noone has authority over it. That means the server needs to drop it.
     
  5. Staggan

    Staggan

    Joined:
    Jul 9, 2015
    Posts:
    10
    The object is a ball that players pickup when they collide with it.. so it is parented to them...

    They can then run around with it parented to their player...

    That all works fine..

    But, when a player kicks the ball none of the scripts that control that kick work... no errors, just they appear not to run. The player actions all work fine...

    How do I deal with this in the UNet environment as so far I seem unable to do so, or find decent reference to assist..

    Thanks
     
  6. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Hard to help you without samples.
     
  7. Staggan

    Staggan

    Joined:
    Jul 9, 2015
    Posts:
    10
    Are there any Unity samples that would show me how to do this?

    Thanks