PhotonView does not exist

2Kin2Kin
I currently have a Photon Cloud subscription, it works great... except during network initialization.

For some clients, "PhotonView" created from "PhotonNetwork.Instantiate" doesn't exist (as the console says !). For other clients, and with the same remote player, data are correctly dispatched.

I managed to minimize the problem by replacing OnPhotonSerialize by some RPC calls (yeah it sounds ugly, but it works better).
I realise that putting PhotonNetwork.isMessageQueueRunning to false also stop PhotonNetwork.Instantiate, so that's obviously not the right way to do it...

I would like to know if there is a way to properly initialize network's instantiations, or at least test if a PhotonView is down... and then how I can "restart" it ?


I search for other related topics without success :(

Problem occures on Unity 3.5.5f3 and PUN 1.16.2 (or hope so... download via Asset Store is tricky for this version : I upgraded it via "Photon Viking Demo").

Comments

  • Hm. This should work, of course, unless you send RPCs for some objects that are not (yet) created. This is why you pause the message queue (goo stuff you already do).

    Does PUN log a few of those messages or does it go on forever?
    What do you mean by "for other clients, and with the same remote player"?

    So, you are loading levels, right? How do you trigger that? Could it be that some OnPhotonSerialize from the OLD level was sending some more updates while you loaded the new level (and thus changed all view IDs)?
    You could try to use a level prefix. This makes it clearer what can be dispatched because levels switched.
  • Thanks for replying, I wasn't sure my explanations were understandable !

    Did you mean that if RPC are sent on objects that are not yet created then PhotonView won't works and drop the "PhotonView does not exist" error forever ?

    PUN log those messages forever, the only way for player to take it back is to "LeaveRoom" and then "JoinRoom". And that I've tried to explain, is that this problem of PhotonView isn't systematic for all players in a room. Sometimes it fails, sometimes it's ok, and I don't know why... that's why I think it's a problem of initialisation due to data sent at the bad time.

    I load a level after a "CreateRoom" or a "JoinRoom" and then make a "PhotonNetwork.Instantiate" of the player.
    You suggest to use "PhotonNetwork.SetLevelPrefix( int prefix )" before "CreateRoom" or "JoinRoom" ?
  • That seems to solve my problems ! But as it's not obvious, I'm steel asking why PUN don't do this by itself.
    What I basically did is :

    For the creation of the room :
    var serverName:int			= 0;
    if(PhotonNetwork.time>10000)
    	serverName			= Mathf.Abs(Mathf.Round(PhotonNetwork.time - Mathf.Round(PhotonNetwork.time/100000)*100000 ));
    else
    	serverName			= Mathf.Abs(Mathf.Round(PhotonNetwork.time));
    
    PhotonNetwork.SetLevelPrefix(serverName);
    PhotonNetwork.CreateRoom(""+serverName, true, true, 14);
    

    And then for other clients
    var data : RoomInfo[] = PhotonNetwork.GetRoomList();
    if(data.Length>0){
    	for(var element:RoomInfo in data){
    		if (GUILayout.Button("ok", GUILayout.Width(25))){
    			var nom:String		= element.name;
    			PhotonNetwork.SetLevelPrefix(parseInt(nom));
    			PhotonNetwork.JoinRoom(nom);
    		}
    	}
    }
    

    Hope it could help.
Sign In or Register to comment.