[Solved]PhotonView.Find(photonViewID) cant find existing PhotonViews
Options
S_Oliver
✭✭✭
Hello,
I got a small Probelm.
I send a int[] to all Clients via RPC, all clients recieve this int[].
Now i loop through this array and use PhotonView.Find(PhotonViewID) to find the PhotonView.
It always give me a NullReferenceException but the PhotonView/GameObject is in the Scene on all Clients.
Do PhotonView.Find only search for local PhotonViews ?
here my Code:
I got a small Probelm.
I send a int[] to all Clients via RPC, all clients recieve this int[].
Now i loop through this array and use PhotonView.Find(PhotonViewID) to find the PhotonView.
It always give me a NullReferenceException but the PhotonView/GameObject is in the Scene on all Clients.
Do PhotonView.Find only search for local PhotonViews ?
here my Code:
[PunRPC] public void SetPoolList(int[] ids) { for (int i = 0; i < ids.Length; i++) { int id = ids[i]; Debug.Log(id); PhotonView pView = PhotonView.Find(id); Debug.Log(pView); GameObject poolObject = pView.gameObject; Debug.Log(poolObject); if (poolObject != null) { poolObject.SetActive(false); Debug.Log(ids[i] + " found."); m_networkPools.Add(ids[i], poolObject); } } }
0
Comments
-
nvm found it
The GameObject with PhotonView Component has to be active to Find them with PhotonView.Find..0