PhotonView does not exist! View was/is ours.

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

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).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

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 :

  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
2019-10-21 16:13:12

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
2019-10-22 15:14:39

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
2019-10-23 08:32:24

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
2019-10-23 08:36:29

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.

Castor
2019-10-23 08:48:38

After experimenting this, I found that this happens only when PhotonNetwork.OfflineMode = true;

JohnTube
2019-10-23 09:56:21

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.

Back to top