NetworkPeer broke!

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

  • 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)
  • 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?
  • flanktusflanktus
    edited November 2020
    @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)
  • 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.
  • In 2019.4.15, did you enable the "fast play" mode (no domain reload in Editor)?
  • flanktusflanktus
    edited November 2020
    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!");
        }
    
  • 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.
  • Joining room stuck at this moment

    MOuuAuO.png
  • @flanktus, did you read @ThomasKao_XRSpace's message? That should help with the join.
  • 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
Sign In or Register to comment.