PUN Basics Tutorial - Error

Options
Hi,

When I play the PUN Basics Tutorial in Unity and quit the game scene (to return to the launcher) I get the following error message:

MissingReferenceException: The object of type 'PlayerManager' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.

I haven't changed anything. I'm surprised to be finding errors in the tutorial provided. Can someone help explain how to fix this?

Cheers,

HK

Comments

  • jeanfabre
    Options
    Hi,

    Uhm, that's strange, I can't repro this here.

    Can you paste the whole error log, it should tell you from where it go this error.

    What version of Unity are you using and what version of PUN?

    Bye,

    Jean
  • Sorry for the delay. Here's the full error log (below). I'm on Unity 5.5.0f3 Personal. All I do is run the tutorial hub, start the Pun Basics Tutorial, create a username and connect from the 'Launcher' scene, then as soon as I hit quit to go back to the launcher scene I get the error. Thanks.

    MissingReferenceException: The object of type 'PlayerManager' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.
    ExitGames.Demos.DemoAnimator.PlayerManager.CalledOnLevelWasLoaded (Int32 level) (at Assets/Photon Unity Networking/Demos/PunBasics-Tutorial/Scripts/PlayerManager.cs:208)
    ExitGames.Demos.DemoAnimator.PlayerManager.m__0 (Scene scene, LoadSceneMode loadingMode) (at Assets/Photon Unity Networking/Demos/PunBasics-Tutorial/Scripts/PlayerManager.cs:111)
    UnityEngine.SceneManagement.SceneManager.Internal_SceneLoaded (Scene scene, LoadSceneMode mode) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/SceneManagerBindings.gen.cs:221)
  • Also, using latest version of PUN available in Asset Store. Thanks
  • jeanfabre
    Options
    Hi,

    Ok, I have a solution implemented, it will make it in the next update of PUN.

    Thanks for your help :)

    Bye,

    Jean
  • Lovely, thank you
  • Also, As I'm already halfway through a project, could you tell me how to remove the issue?
  • jeanfabre
    Options
    Hi,

    I am puzzled as to why this affect your project, because this only happens when you run the demo hub.

    In you project, I strongly suggest to remove all demos, first to remove unecessary processing during compilation, and also because these are assets that are unlikely to be used inside your own project.

    Can you confirm? or else can you explain how this affect your production?

    Anyway, here's the PlayerManager.cs link updated attached to this post.

    Bye,

    Jean