Im creating a 3d multiplayer game and i started using photon. Everything was perfect until i tried to play online. When i enter from another device the variable view.IsMine changes automatically for some reason and the player in other device controls my player. Can someone help me please?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
public class Mototron : MonoBehaviour
{
public float speed = -21f;
private float targetAngle = 90f;
public float enemyK = 0f;
public bool isMoving = false;
public GameObject boxPrefab;
public GameObject deadCanvas;
public GameObject wonCanvas;
public bool box;
PhotonView view;
void Start()
{
view = GetComponent<PhotonView>();
}
public void Update ()
{
movement();
}
void movement ()
{
if(Input.GetKey(KeyCode.W) && view.IsMine)
{
transform.Translate(Vector3.forward * speed * Time.deltaTime);
}
}
}
I want to make that the devices control the exact player they are playing with!
Nvm already fixed that, just destroy the other player camera if its not yours, like this