Unity freeze

Options
chebz
chebz
Hi guys,
I am experiencing very frustrating Unity freezes and can't find possible cause for it. I wonder if it could be related to Photon PUN?
it only seems to happen after I connect to the server at least once. The next time I make any code change, Unity editor will freeze when trying to compile code and need to be closed through task manager.
I've tried everything, even copying all my assets into new project but nothing helps. Nobody has idea what's happening on Unity forums either.
It started happening after I updated to 4.5.1 and updated to latest version of PUN plugin. Perhaps anybody have any thoughts on what may be causing this or maybe experienced this issue before?
Thanks for any advice.

Comments

  • Tobias
    Options
    It could be PUN related, yes.
    Check your PhotonHandler class and see if there's a OnApplicationQuit(). It should PhotonHandler.StopFallbackSendAckThread() and PhotonNetwork.Disconnect().

    It seems to be related with the Background Thread we use to run PUN when Unity refuses to call Update (during Loading, etc). When recompiling, this seems to break.
    The upcoming PUN 1.26 definitely has this fixed. I'm not sure when I added this though.
    I also added a check to Connect*() if the app is quitting, to avoid re-connecting in this case.

    I hope this helps. Sorry for the issues. I wasn't aware of a fix when we released the last PUN update.
  • chebz
    Options
    I am confused, where is StopFallbackSendAckThread?

    I have my PhotonClient class which implements IPhotonPeerListener interface.
    I also have reference to LiteLobbyPeer.
    But I dont see that function anywhere.
    There is peer.StopThread(); however?
  • chebz
    Options
    Here's the code that I've added to my PhotonClient class:

    void OnApplicationQuit()
    {
    _peer.StopThread();
    _peer.Disconnect();
    }

    Not a single freeze for entire day, whereas before Unity was unusable!
  • Tobias
    Options
    Excellent.
    I copied the methods from my latest PUN where they might have other names.
    StopThread is what I meant.
    Glad it helped!