Loading Sence When Start Button is Pressed

public void LoadLevel(string name)
Debug.Log(“Level Loaded” + name);


While Watching a Course on Unity Scripting, we are now learning how to load scene by clicking a button. The code above is what i have written, the code that is used in the video uses the Application method which is obsolete.

I have added my scenes to the build settings but when i click on the start button it gives me this error:
Scene ‘’ (-1) couldn’t be loaded because it has not been added to the build settings or the AssetBundle has not been loaded.

Through reading the documentation it states that i must load the assets, does this apply to what i am doing or am i missing a line of code?

Fixed it i removed all of the code and i redid the method by just using SceneManager.LoadScene(“name”)