Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Networking Multiplayer - Multiple NetworkTransforms with local authority

Discussion in '5.1 Beta' started by Pelican_7, Jun 4, 2015.

  1. Pelican_7

    Pelican_7

    Joined:
    Nov 25, 2014
    Posts:
    190
    Hi all,

    We are building a multiplayer game using Unity's new Networking framework. We have run into an issue with local player authority for local player controlled objects.

    Our player prefab consists of multiple child NetworkTransforms (vehicle, weapon, etc.) and we need the player to have localAuthority over these objects. However, it seems that once the player has been spawned by the NetworkManager, the child NetworkTransforms do not have localAuthority. We have tried spawning these prefabs as well as embedding them in the original player prefab, but in both cases only the topmost GameObject actually has localAuthority.

    This causes no movement to occur since the server is being authoritative about the transform and input is only received for the local player.

    How can we have multiple NetworkTransforms with local authority?

    Thanks in advance,
    Andy
     
  2. De-Panther

    De-Panther

    Joined:
    Dec 27, 2009
    Posts:
    589
    If only the parent moves by Rigidbody or Character Controller, just make a NetworkBehaviour with [SyncVar]s and [Command]s that save the location of the child transforms, and put it on the parent gameobject.
     
    AlwaysBeCoding247 likes this.
  3. Pelican_7

    Pelican_7

    Joined:
    Nov 25, 2014
    Posts:
    190
    Hi De-Panther,

    Ahhh, so we can sync child transforms from the parent/player with authority via SyncVars.

    Thanks for the response.
     
    AlwaysBeCoding247 and De-Panther like this.