- Home /
Question by
PyroSneak · Jun 09, 2013 at 07:42 PM ·
instantiatenetworkclientnetwork.instantiate
Network.Instantiate only Instantiates on one client.
what happens is that I have clients connect to a host, who is also a client. once the game starts a new scene loads with a object that sets up the team and class of the player. however right now it only has a spawn button. this spawn button should instantiate the player, then destroy itself. however when instantiating, using Network.Instatiate it only instantiates on the client who called it.
I have no idea what's going on and have searched many times throughout this site and youtube and the unity reference manual for answer but I can't seem to get it working.
Here's the code
#pragma strict
var spawns : GameObject[];
var testplayer : GameObject;
function Start () {
}
function Update () {
}
function OnConnectedToServer(){
}
function OnGUI(){
GUILayout.BeginVertical('Box');
if(GUILayout.Button("spawn player")){
Network.Instantiate(testplayer, spawns[0].transform.position, Quaternion.identity, 0);
Destroy(gameObject);
}
}
Comment