Received RPC "RPCname" for viewID 2010 but this PhotonView does not exist! View was/is ours. Remote called. By: #01 'name'
using Photon.Pun;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bullet : MonoBehaviour
{
public PhotonView PV;
int dir;
void Awake()
{
PV = GetComponent<PhotonView>();
}
void Start() => Destroy(gameObject, 10f);
void OnTriggerEnter2D(Collider2D col) // col을 RPC의 매개변수로 넘겨줄 수 없다
{
if (col.tag == "Border") PV.RPC("DestroyRPC", RpcTarget.AllBuffered);
if (!PV.IsMine && col.tag == "Player" && col.GetComponent<PhotonView>().IsMine) // 느린쪽에 맞춰서 Hit판정
{
col.GetComponent<Player>().Hit();
PV.RPC("DestroyRPC", RpcTarget.AllBuffered);
}
}
[PunRPC]
void DirRPC(int dir) => this.dir = dir;
[PunRPC]
void DestroyRPC()
{
Destroy(gameObject);
}
}
I'm making a two-player shooter game, and bullets disappear when they hit a wall, but leave a warning message like that.
I asked chatGPT, so he said like this, but It not worked
if (PV != null && PV.IsMine)
It seems like you've completely messing up the workflow of a networked object. Please read the Photon Engine's manual on how to instantiate and delete networked entities. Besides that, it's not a good practice to make your bullets replicated in this way since you'll get all sorts of logic controversy for different players because of a floating point precision and network snapshot delay. It would be much better to have a network entity of a weapon that sends information aboul all bullets shot to other players from server.