Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Unity Multiplayer Child of Local Player does not have local authority?

Discussion in 'Multiplayer' started by OpticalOverride, Jun 18, 2015.

  1. OpticalOverride

    OpticalOverride

    Joined:
    Jan 13, 2013
    Posts:
    161
    I'm new to UNet (as I imagine we all are...) and I may just be confused here...

    With that said, I have the server spawning a player game object into the scene when a client connects. This prefab being spawned also has a child object (a weapon) with a component that allows the weapon to pass damage [Command]s to the server. However, this child weapon object is stating that it does not have local authority and therefore cannot send the [Command]... For instance, if I write print( isLocalPlayer ); or print( isClient ) on the Weapon.cs component, they both return false.

    Is this normal behaviour? I would assume child objects of the local player that are spawned by the server would also be considered part of the client's authority... Should I be reporting this as a bug or is it only the root of the prefab being spawned by the server (and it's associated components) that have local authority?

    If this is a(nother) bug, I'm about to throw the towel in on UNet until Unity gets around to fixing it in the coming months.
     
  2. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    459
    brainwipe and thephysicsphreak like this.
  3. OpticalOverride

    OpticalOverride

    Joined:
    Jan 13, 2013
    Posts:
    161
    I had a feeling it was somewhere buried in the new API manual. Just started playing with UNet yesterday after work...

    Thanks!

    EDIT: This link is helping a lot, was just using the Script Reference before... thanks again!
     
    Last edited: Jun 19, 2015
    chrismarch likes this.