Alright I'm about to lose my mind, this seems insanely trivial but I've spend 4 days and non stop googling to try and figure this out and I simply can't.
What I'm trying to accomplish: A simple lobby system, thats it, When players connect I DON'T WANT THEM TO SPAWNS THE PLAYER PREFABS. Okay, that's easy, just don't tick the box right? okay, now both players readied up, now I want the SERVER TO SPAWN ALL THE PLAYER CHARACTERS. I've tried everything and this is just stupidly hard.
The best suggestion I've seen for this is to create a "dummy" object and instantiate it in the OnServerAddPlayer method.
Alright find, that's stupid but sure, But, now Both players click their ready buttons, I want the server to instantiate the player objects. How? Once the last player hits the ready button, we call a [Command]
for (int i = 0; i < m_Connections.Count; i++)
GameObject go = (GameObject)Instantiate(m_goPref, new Vector3(0, 3, 0), Quaternion.identity);
What am i supposed to do in this server method to access all players? Do I need to store an entire list of all the client connection to the server and then give them authority? oh wait a minute this doesn't actually work. isLocalPlayer is false on all instances of the spawned objects, even though I spawned it giving it local authority. So is there another way to do this?
Are there ANY tutorial on UNet that aren't using the built in instant spawn on connection?
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
144 People are following this question.
Networking concept and spawning questions
NetworkServer.Spawn() only on Server (with registered prefabs) [Unity 5.2.3f1]
NetworkLobbyManager: How to spawn a lobbyprefab as the child of another GameObject.
NetworkServer.Spawn() not being called
How to use a script to control the nickname of online players