Im trying to stop the two online characters to move with the same input. They move in different ways so they which have their own movement code and they come from the abstract class IMovement. I’ve tried changing it back to MonoBehaviour but it didn’t work.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
public class PuzzlerMovement : IMovement
{
public PhotonView pv;
public float speed = 5.0f;
private IMovement p_movement;
void Awake(){
if(pv = GetComponent<PhotonView>()){
Debug.Log("Got component");
}
}
void Start(){
if(!pv.IsMine){
Debug.Log("PV is not mine");
p_movement = GetComponent<IMovement>();
p_movement.enabled = false;
}
}
void Update()
{
float vertical = Input.GetAxis("Vertical");
float horizontal = Input.GetAxis("Horizontal");
Vector3 dir = new Vector3(horizontal, 0f, vertical).normalized;
transform.Translate(dir * Time.deltaTime * speed);
}
}
I’m confuse because in the Spawned Prefab editor PhotonView attribute says that: IsMine: true.
Why is it always returning false? How do i make it return true? Is there another way to make the movements not overlap?
Obs: They are being spawned with a PhotonNetwork.Instantiate and they do have a view ID.