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. Dismiss Notice

How do you create a networked object on server start.

Discussion in 'Multiplayer' started by KyrahAbattoir, Sep 17, 2016.

  1. KyrahAbattoir

    KyrahAbattoir

    Joined:
    Sep 17, 2016
    Posts:
    1
    I would like to have a networked object to broadcast on all clients the global state of the game session and i figured out the simplest way would be through a server owned networkbehavior.

    The problem is that i cannot figure out where to spawn it, all the events i tried on the network manager complain that the network is not available, so I assume that I am trying too early?

    Also just to double check, to create an object on server and client i have to instantiate it server side and then spawn it right?
     
  2. gintautass

    gintautass

    QA Minion Unity Technologies

    Joined:
    Oct 27, 2015
    Posts:
    46
    Just wait for a frame after the server has been started, then use NetworkServer.Spawn() on that object. Make sure to add this object prefab to your NetworkManager spawnable object list.