I need a script for multiplayer!
I am using this code to move:
var speed = 5;
var gravity = 5;
private var cc:CharacterController;
function Start(){
cc = GetComponent(CharacterController);
}
function Update(){
if(networkView.isMine){
cc.Move(Vector3(Input.GetAxis(“Horizontal”) * speed * Time.deltaTime, Input.GetAxis(“Vertical”) * speed * Time.deltaTime));
}
else{
enable = false;
}
}
more when I move, it moves the wrong camera.
I am using this code at the camera:
function OnNetworkInstantiate(info : NetworkMessageInfo){
if(networkView.IsMine){ //if I am the owner of this prefab
Camera.main.GetComponent(SmoothFollow).target = transform;
}
}