PUN Basics Tutorial crash after 8 chapter.

Options
Hello. I was trying to solve the problem by myself, and even looking for solving the same problem if someone already found why it happens, but I didn't find anything. After the 8th Chapter of PUN Basics Tutorial I found that game crashes after pressing Fire1 button and trying to make a beams, everytime I press the left mouse button the game crashes.

Here the debug log: 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.
Com.xyz.DoNut.PlayerManager.CalledOnLevelWasLoaded (Int32 level) (at Assets/DonutProject/Scripts/PlayerManager.cs:183)
Com.xyz.DoNut.PlayerManager.m__0 (Scene scene, LoadSceneMode loadingMode) (at Assets/DonutProject/Scripts/PlayerManager.cs:91)
UnityEngine.SceneManagement.SceneManager.Internal_SceneLoaded (Scene scene, LoadSceneMode mode) (at C:/buildslave/unity/build/Runtime/Export/SceneManager/SceneManager.cs:122)

And after I have completed the 9th chapter new problem comes out, cause of this PlayerManager reference is missing. Here is the debug log:
NullReferenceException: Object reference not set to an instance of an object
Com.xyz.DoNut.PlayerUI.Update () (at Assets/DonutProject/Scripts/PlayerUI.cs:50)

I will appreciate any help and the main idea, why it happens. Thanks.

Comments

  • hxckid
    hxckid
    edited December 2018
    Options
    You may close the topic. I didn't find the solution, just have imported your PUN basics tutorial scripts into my project and everything works ok now. I will learn your imported PUN scripts striving further, but I'm quite sure there is a mistake somewhere there in text step by step tutorial (maybe coz of Unity changed some methods and features).