Ok so Im looking at this script reference Unity - Scripting API: Network.Instantiate
I get everything but the group at the end of this line.
static function Instantiate (prefab : Object, position : Vector3, rotation : Quaternion, group : int) : Object
What does that mean group? Can I use that to chose which spawn point the player spawns at?
Thanks for any help with this
Basically, the group parameter allows you to classify the networkviews of objects, in order to selectively choose which networkview sends data to what. (Although the documentation is pretty vague about it and you ought to experiment with it a bit)
In order to have your players choose a spawn-point to spawn at, you should have a manager script that determines which user wants to have an object to spawn, and then determine which team that user is, and then pick a random position from an array of spawnpoints.
For instance, for a two-player game you can use:
This is a fairly butchered part of my network player instantiator, it is attached to the floor and depending on whether the player is the server or the client, they spawn their player prefab accordingly (and in my case, the player prefabs for player one and player two have different roles, so they are different prefabs). In a game with more than two players, you could have an array called team, whose length is the amount of players in the server, and use that in conjunction with NetworkPlayer.ToString() to store each player’s team and spawn their player objects accordingly.