- Home /
Networking Problem please Help
Hello i made a script that if you press the left mouse button the gun shoots. everything is working perfecly but if i update my script with
if(!isLocalPlayer)
{
return;
}
it wont work anymore and i don't get an Error.
thats the script without the Network Update.
#pragma strict
public class Shoot extends UnityEngine.Networking.NetworkBehaviour{
var Projectil:Rigidbody;
var reloadeTime:int;
var isReloading:boolean = false;
function Update () {
if(Input.GetButtonDown("Fire1") && isReloading == false)
{
Debug.Log("I did a Shoot");
Instantiate(Projectil, transform.position, transform.rotation);
isReloading = true;
Invoke("Reloade", reloadeTime);
}
}
function Reloade(){
isReloading = false;
}
}
and this si with the Network Update.
#pragma strict
public class Shoot extends UnityEngine.Networking.NetworkBehaviour{
var Projectil:Rigidbody;
var reloadeTime:int;
var isReloading:boolean = false;
function Update () {
if(!isLocalPlayer)
{
return;
}
if(Input.GetButtonDown("Fire1") && isReloading == false)
{
Debug.Log("I did a Shoot");
Instantiate(Projectil, transform.position, transform.rotation);
isReloading = true;
Invoke("Reloade", reloadeTime);
}
}
function Reloade(){
isReloading = false;
}
}
please Help.
Comment
Your answer
Follow this Question
Related Questions
How to call/Execute from C# to JS? 1 Answer
Social Network JS Sdk 0 Answers
Network information 1 Answer
Can't move in Run version C# 1 Answer