Search Unity

Unity Multiplayer [SOLVED] Lobby Manager "send" to other players with Prefab information and my information

Discussion in 'Multiplayer' started by Krause-Biagosch, Oct 24, 2017.

  1. Krause-Biagosch

    Krause-Biagosch

    Joined:
    Mar 8, 2017
    Posts:
    19
    Hi
    I change my static list of the players to the dynamic list, and I am use Network Lobby (https://www.assetstore.unity3d.com/en/#!/content/41836) for the dynamic list works fine
    for the Lobby and there I want to call some people.

    Unbenannt.PNG
    I change a little the PlayerInfo Prefab I add some InputFields and a Call button.

    So now I want example call the person A and I want click the call take the information from prefab A and set my information too and send it to the server/clients.

    But I have this problem every time if I try press the call button prom other players with there functioni get error/warning:
    "Trying to send command for object without authority.
    UnityEngine.Networking.NetworkBehaviour:SendCommandInternal(NetworkWriter, Int32, String)"


    If I click my "C" Call Button then I can send information from my prefab to the other players but it not helps me to create the call.

    Have you ideas how I can take the information from the other players from the prefab and send it with my information to all/special player that there open a window for the call panel?

    Best regards and thanks all for any ideas,
    Waldy
     
  2. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    3,971
    Does your object have authority?
    Doesn't seem like it, so might be best to send a regular packet over there
     
  3. Krause-Biagosch

    Krause-Biagosch

    Joined:
    Mar 8, 2017
    Posts:
    19
    I think you mean as object my Prefab PlayerInfo.

    That is my PlayerInfo it set as "Local Player Authority"
    PlayerInfo.PNG

    or which object do you mean?
     
  4. Krause-Biagosch

    Krause-Biagosch

    Joined:
    Mar 8, 2017
    Posts:
    19
    Have any one idea for to get information from Prefab example "Calling Name" and sent it to all members with my name (PlayerName) and and other player (CallingName)?

    So that all can check is there his name if yes start the call function.
     
  5. Krause-Biagosch

    Krause-Biagosch

    Joined:
    Mar 8, 2017
    Posts:
    19
    i have now the solution i work with class static reference to the object from the local player

    in the LobbyPlayer.cs
    Code (CSharp):
    1.  
    2. public class LobbyPlayer : NetworkLobbyPlayer
    3. {
    4. protected static LobbyPlayer callLobbyPlayer;
    5. ...
    6. public void Start()
    7.    {
    8.       if (isLocalPlayer)
    9.          {
    10.              callLobbyPlayer = this;
    11.          }
    12.    }
    13. ...
    14. }
    and with this reference callLobbyPlayer I can call from all Prefab Objects to all sync variable and all CmdFunctions() from the LocalPlayer and I don't have more the ERROR
    "Trying to send command for object without authority.
    UnityEngine.Networking.NetworkBehaviour:SendCommandInternal(NetworkWriter, Int32, String)"

    and it synchronising my sync var and open cmd function with all players/server

    :D
     
    Last edited: Nov 8, 2017
unityunity