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.

Unity Multiplayer Player vs Object spawning order.

Discussion in 'Multiplayer' started by Shinyclef, Jun 10, 2015.

  1. Shinyclef

    Shinyclef

    Joined:
    Nov 20, 2013
    Posts:
    470
    Hello,

    I'm wondering if there is a way to tell the server to always spawn the local player object before other objects for a connecting client.

    The reason I hope to achieve this is to access the local player object (and thus server commands) during custom spawning procedures of the other objects.

    Thanks.
     
  2. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,284
    For this you need a sort of ObjectSpawnerManager which checks if the player already spawned (there's some callbacks that tells you when a player connected, including local one).
    So don't spawn anything until players (or whatever entity) is spawned on clients/servers.
     
  3. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,284
    Stupid me, now that I remember, when you add NetworkIdentity to objects they should automatically wait for player spawn! This is handled by the NetworkManager itself.