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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unet, Multiplayer, Network

Discussion in 'UNet' started by manukanne, Aug 17, 2015.

  1. manukanne

    manukanne

    Joined:
    Jul 17, 2015
    Posts:
    8
    I want to find a way to spawn several player objects. So one player have for instance two player objects.
    So at first to make this possible i had to find a way to spawn player objects after connecting to the server.
    upload_2015-8-17_11-49-38.png
    In the offline scene you can choose if you want to start as Client, a server or a host. Then you come to the game Scene (Little map). In this Scene is a empty gameObject with the "SpawnScript" atteached. This Script should spawn the player object.
    My Problem is, after spawning the player I get the Error "A connection has already been set as ready. There can only be one.UnityEngine.Networking.NetworkManager:Update()". In the Scene is now one player object. (was started as a host). Now a other Client connect to it. Now there are 3 cubes and 2 Clients.
    Can anybody help me or have an idea how to solve this Problem?
     

    Attached Files:

  2. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    sounds like your Start function is being called twice. Put some logging in it?
     
  3. manukanne

    manukanne

    Joined:
    Jul 17, 2015
    Posts:
    8
    I put into the void Start() function a Debug.Log(Startfunction called) and i get only called once.
     
  4. LevonRavel

    LevonRavel

    Joined:
    Feb 26, 2014
    Posts:
    177
    I honestly do not think you can create two network connections like this, What you are trying to do actually would be to connect the client to the server ready the players connection, Then you want to request the server to create what ever objects you want.
     
  5. manukanne

    manukanne

    Joined:
    Jul 17, 2015
    Posts:
    8
    I solved my Problem ;) it is possible that one Connection has one or more playerobjects with the authority "local Player". To make this possible the Client have to "tell" the Server that he want to spawn a Player.
     
  6. LevonRavel

    LevonRavel

    Joined:
    Feb 26, 2014
    Posts:
    177
    mentioned that in my above post glad you figured it out.