NetworkPeer broke!

Options
Hi, when I try to join a game room, I have to wait a long time, which has no effect anyway, it is impossible to create or join a room. Every now and then I get an error when I try to connect

NetworkPeer broke!
Photon.Pun.PhotonHandler:FixedUpdate() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:149)

Comments

  • flanktus
    Options
    I also get another error

    NullReferenceException: Object reference not set to an instance of an object
    Photon.Pun.PhotonNetwork.AddCallbackTarget (System.Object target) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:106)
    Photon.Pun.PhotonHandler.OnEnable () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:120)
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @flanktus,

    Thank you for choosing Photon!

    What PUN version is this?
    How to reproduce?

    Does this happen in Unity Editor or in a build?
    Which Unity version?
    Which target platform?
  • flanktus
    flanktus
    edited November 2020
    Options
    @JohnTube

    1. PUN v2 2.23.0
    2. https://pastebin.pl/view/1959013c <- code
    3. In editor and in build
    4. Unity 2019.4.15f1
    5. Normal Windows App (.exe)
  • Tobias
    Options
    NullReferenceException: Object reference not set to an instance of an object
    Photon.Pun.PhotonNetwork.AddCallbackTarget (System.Object target) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:106

    This looks as if the NetworkingClient is null?

    Not sure how this happens yet but my tip:
    Try using Start() instead of Awake() in your code. There may be some race condition for this and we didn't notice yet or it's new.

    Thanks for the truly minimal code. Much appreciated it's not a bunch of classes and GOs.
  • Tobias
    Options
    In 2019.4.15, did you enable the "fast play" mode (no domain reload in Editor)?
  • flanktus
    flanktus
    edited November 2020
    Options
    Turning on and off fast play didn't change anything. Start() instead of Awake() too.
  • PhotonNetwork.JoinRandomRoom() have to be paired with public override void OnJoinRandomFailed(short returnCode, string message)
    other than that your code works
    public override void OnJoinRandomFailed(short returnCode, string message)
        {
            base.OnJoinRandomFailed(returnCode, message);
            Debug.Log("JoinRandomFailed FAILED!");
        }
    
  • Tobias
    Options
    I tested in Unity 2019.4.13 and your code (attached to a camera in a new scene) works for me in PUN 2.24, which is not that different from 2.23.
    I have no idea what is going on. It could be Unity 2019.4.15 or maybe some package or other race condition, which I can't repro. The problem is: I can't help without doing so.

    If you want to, look out for the code NetworkingClient = new LoadBalancingClient(protocol); in PhotonNetwork.cs and debug if this is being called or if it fails somehow. Also, you could debug which code is accessing the NetworkingClient, should it be accessed earlier than the assignment. In best case, we get a log with debug log settings.
  • flanktus
    Options
    Joining room stuck at this moment

    MOuuAuO.png
  • Tobias
    Options
    @flanktus, did you read @ThomasKao_XRSpace's message? That should help with the join.
  • flanktus
    Options
    Still not working. Interestingly, however, other projects work hahah
    I have no ideas what I can do to make everything work, probably the only thing left for me is to create a new project and transfer everything from the old one