We have X players logged into a game. now we want everyone to have an object network.instantiated but - obviously - we want to have them created in different spots. Let's say we pre-create a few spots on the map where we want players to be instantiated.
So I was thinking
a)- server could generate random number and send it to a player, so that he is instantiated on a spot 1,spot2,(...).
b) players are created in the spot 1, spot 2, spot 3 or spot 4 (...) depending on the order they got connected. [does one have to use "Network.connections" to do this somehow?
I don't know how to change an integer in another players script,
A rough sketch:
function Awake () {
if(Network.isServer)
var connectionss = Network.connections;
for(var i =0; i< connectionss.Length; i++){
connectionss*.GetComponent(GeneratingObjects).GetSpot(i);*
*}*
*}*
*var object_prefab:Transform;*
*var spots:Vector3[];*
*function GetSpot(spot_index:int){*
*Network.Instantiate(object_prefab, spots[spot_index], Quaternion.identity,0);*
*}*
*```*
*<p>Any idea how to actually do that?</p>*