NullReferenceException: Object reference is not set to an instance of an object

Hi. I’m on the laser defender section in the Udemy 2d course and have just implemented Level Loader. When I click on a “Start” button in a “Main menu” it gets me on a “game” scene but the scene is empty and I get that NullReferenceException.
When I run the game scene directly everything works fine.
I’ve checked and I spelled names correctly.

public void LoadGameScene()
    {
        SceneManager.LoadScene("Game");
    }

Thanks in advance.

Oh. I’ve checked waves script instances and when I run the game scene directly those waves scripts load properly but when I load the game scene from another scene I get the error under every wave script instance

The associated script cannot be loaded, please fix any compile errors and assign a valid script

Hi,

How are you getting on with this? Did you fix the compiler errors in your script?

This topic was automatically closed after 14 days. New replies are no longer allowed.