photonView.isMine doesn't work

Options
using UnityEngine;

public class Movement : Photon.MonoBehaviour {

public float speed = 6.0F;
public float jumpSpeed = 8.0F;
public float gravity = 20.0F;
public float rotateSpeed = 150.0F;

private Vector3 moveDirection = Vector3.zero;

void Update() {

CharacterController controller = GetComponent();
if (photonView.isMine) { //this line return error

if (controller.isGrounded) {

moveDirection = new Vector3(0, 0, Input.GetAxis("Vertical"));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;

if (Input.GetButton("Jump")) {

moveDirection.y = jumpSpeed;
}
}

moveDirection.y -= gravity * Time.deltaTime;
controller.Move(moveDirection * Time.deltaTime);
transform.Rotate(0, Input.GetAxis("Horizontal") * rotateSpeed * Time.deltaTime, 0);
}
}
}


Please help, sorry because i'm new working with photon and my english isn't good

Comments

  • romadritex
    Options
    If i change photonView.isMine for PhotonView.isMine() Visual studio dosen't return error, but unity says "the type PhotonView already contains a definition for isMine
    "
  • Gage_IAG
    Options
    @romadritex So you do want to use photonView.isMine. Where are you wanting to call this and what was your main purpose for this check? Are you limiting input on the controller to only the local player with that?