- Home /
Question by
mirkobon · Oct 19, 2013 at 06:36 AM ·
instantiatenetworknetwork.instantiate
Network.instantiate only works for Server to client
If i press the respawn on the server it works fine, but if I press it on the cliet i will see it on the client but not on the server.
script:
var dead : boolean = true;
var player : Transform;
var spawnpoint : GameObject;
var MyPlayer : boolean = false;
function Start ()
{
}
function Update () {
}
function OnGUI ()
{
if(dead == true)
{
if (GUI.Button(Rect(50,50,100,100),'Respawn'))
{
Debug.Log("respawned");
Network.Instantiate(player, spawnpoint.transform.position , spawnpoint.transform.rotation, 1);
dead = false;
MyPlayer = true;
}
}
}
Comment
When you join, and are in a server, then you load level, the objects are deleted, so either use do not destroy on load, or load the level and then connect.