PhotonView does not exist! View was/is ours.

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 :

1. join photon netwok.
2. Upon successful creating a room, I load game scene using PhotonNetwork.Loadscene
3. After game scene was loaded, I then call above RPC. RPC call was a success.
4. leave the room and go back to the menu scene. (after successful onleft room call)
5. join photon network again.
6. Create the same room again, then load the game scene.
7. 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

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Castor,

    4. leave the room and go back to the menu scene. (after successful onleft room call)
    5. join photon network again.
    6. Create the same room again, then load the game scene.

    Could you share code snippet or method used for each of these step?

    Do you have 16 PhotonViews for the player instantiated in that same scene?
  • Castor
    Castor
    edited October 2019
    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.
  • Castor
    Castor
    edited October 2019
    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();
        }
  • Castor
    Castor
    edited October 2019
    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;
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited October 2019
    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.