PUN 2 event got registered even though different App ID was used

Options
Hello,

I have experienced a strange behavior in my project which uses PUN2. I have one app ID for the production version of the project (which is built and used on some PCs) and a completely different ID (even though it is on the same account) which is used while developing. Recently I triggered action in my development environment and the PUNRPC event got registered in our production setup EVEN THOUGH IT USES DIFFERENT APP ID. The PUNRPC method looks like this:

[PunRPC]
private void MethodName(String someValue)
{
foreach (Transform child in transform)
{
DoSomething();
}
someVariable= true;
someOtherVariable= false;
}

and I call it like this:

photonView.RPC("MethodName", RpcTarget.AllBuffered, someValue);

(I use RpcTarget.AllBuffered because it is essential that the event gets registered by the players that join later)

How is this possible? Is there a way to safely separate our production from development, so that the development process doesn't disturb our production and we can all work at the same time?

Any help would be much appreciated, we are really in need of a solution.

Thanks to everyone in advance!
BD

Comments

  • Tobias
    Options
    We are using AppIds to separate games since years and it's a central pillar in splitting games overall and even dev from release, etc.. This is the first time I ever heard about such a case.

    Chances are you mixed up appids somehow and ended up in the same room as someone else.
    Or do you host the server yourself? Then I have bad news: The Photon Server SDK 4.x does not support appid's as such and you need to separate players by running multiple servers (e.g.).
  • bdar
    bdar
    edited May 2020
    Options
    I used the PUN Wizard to change the app ID. I could see it being changed in the Server Settings and also I did not see any other users, which I know for a fact were using the app, while in play mode in the editor. After not seeing any players, I assumed the change of app ID worked. After the error, however, I checked the traffic on the dashboard and saw no traffic in our development app, and a lot of traffic under our production ID (which I counted and it seems that the count really did include me). So I assume the change did not completely happen. What should I have done differently for the change to take effect? Restart the editor? Delete the library? I am using Unity 2019.3.0f6. We do not use a self-hosted server yet, but this information, you provided is good to know.
  • Tobias
    Options
    Usually, changing the appid in the PhotonServerSettings object is enough - provided you use PhotonNetwork.ConnectUsingSettings() to connect (which most do). It will take effect the next time you run (no recompile necessary).
    You could check if there are multiple instances of ServerSettings in your project (search should be t:ServerSettings or so). Delete all but one.
  • bdar
    bdar
    edited May 2020
    Options
    I am using PhotonNetwork.ConnectUsingSettings() to connect. I checked and the search t:ServerSettings only returned one instance of the settings file. This is how I manage the connection to photon server (I took it from one of the Photon tutorials)
    private string _room = "VR_starter";
    public void Connect()
        {
            // we check if we are connected or not, we join if we are , else we initiate the connection to the server.
            if (PhotonNetwork.IsConnected)
            {
                // #Critical we need at this point to attempt joining a Random Room. If it fails, we'll get notified in OnJoinRandomFailed() and we'll create one.
                PhotonNetwork.JoinRandomRoom();
                Debug.Log("connected via Connect()");
            }
            else
            {
                // #Critical, we must first and foremost connect to Photon Online Server.
                PhotonNetwork.ConnectUsingSettings();
            }
        }
    
     public override void OnConnectedToMaster()
        {
            Debug.Log("joined lobby");
    
            RoomOptions roomOptions = new RoomOptions() { IsVisible = true, IsOpen = true };
            PhotonNetwork.JoinOrCreateRoom(_room, roomOptions, TypedLobby.Default);
            Debug.Log("connected via OnConnectedToMaster()");
        }
    

    And I call it simply from start like this:
    void Start()
        {
            Connect();
            Debug.Log("connected");
        }
    
  • Tobias
    Options
    Looks solid.
    If you enable the SupportLogger, the used AppId is logged (abbreviated). So this could help double check what's going on.
    Aside from that, I would skip searching for the problem now and continue if it reproduces.
  • bdar
    Options
    Thank you, I will give the SupportLogger a try. Thanks for help!