PhotonView does not exist! View was/is ours.
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
PhotonView does not exist! View was/is ours.
Castor
2019-10-18 08:44:14
Hi. I am getting following error / warning.
Received RPC "EquipWeaponRPC" for viewID 1016 but this PhotonView does not exist! View was/is ours. Owner called. By: #01 ''
This happens as below :
- join photon netwok.
- Upon successful creating a room, I load game scene using PhotonNetwork.Loadscene
- After game scene was loaded, I then call above RPC. RPC call was a success.
- leave the room and go back to the menu scene. (after successful onleft room call)
- join photon network again.
- Create the same room again, then load the game scene.
- The error happens when I call above RPC.
So the error happens from second attempt onwards. Upon closer inspection, I noticed that the same photonview component on the same prefab has different id, seems like they were incremented from previous ones. So the id keeps growing.
What did I do wrong? I thought that after disconnecting, leaving the room, the ids should be reset? There are no other players in the room, only master client. It looks like Photon thinks that there is still an old photon view left somewhere, when I have clearly cleaned them up by loading a menu scene to get rid of them. Also the call for the consecutive RPC calls makes call with the id that belonged to the photonview that made first RPC call. Both are wrong in my opinion.
Comments
Hi @Castor,
Do you have 16 PhotonViews for the player instantiated in that same scene?
I will try and post more code tomorrow. But yes i have few of photon views, some for syncing movements, animator and some for different types of inventories. I will have to try and count exactly what are the 16 of them thou...
Just quick from my head, i tried to load menu scene from game scene by both scenemanager and photonetwork loadscene functions. They both work but with the same problem as above. When menu is loaded my player prefab with photon views are destroyed due to obvious reason. It was instantiated inside game scene. Strange enough, even after completely disconnected from photon network it still increments photon view id after reconnecting to photon and recreating the room.
For loading menu scene from game scene I do :
PhotonNetwork.LoadLevel("Menu");
while (PhotonNetwork.LevelLoadingProgress < 1)
yield return null;
For connecting to PhotonServer :
PhotonNetwork.ConnectUsingSettings();
For creating Room :
public void CreateRoom(int numPlayer)
{
punRoomMaxPlayers = numPlayer;
if (!PhotonNetwork.IsConnected)
{
Debug.Log("Game is not connected to the master server.");
GameEventMessage.SendEvent("InGameFailed");
return;
}
RoomOptions roomOptions = new RoomOptions();
string roomName = punRoomID + "_" + punRoomPassword;
roomOptions.IsVisible = true;
roomOptions.IsOpen = true;
roomOptions.MaxPlayers = (byte)punRoomMaxPlayers;
roomOptions.CustomRoomProperties = new ExitGames.Client.Photon.Hashtable()
{
{"displayname", punRoomDisplayName }
};
roomOptions.CustomRoomPropertiesForLobby = new string[]
{
"displayname"
};
PhotonNetwork.CreateRoom(roomName, roomOptions, null);
//uiNetwork.DisableAll();
}
Also, upon counting photonviews, I only have 9 of them plus one perm one that sits inside scene and its id is 999 ... And the next time I create a new room their id starts from 10 and so on and 16th photon id view was creating such error because I was calling RPC with it. So ids gets incremented everytime I (master client) leave the room and then recreate the room again.
After experimenting this, I found that this happens only when PhotonNetwork.OfflineMode = true;
Hi @Castor,
You mean that this issue happens only in OfflineMode?
At which point you enable offline mode?
If so then this is a good hint at how to reproduce this.