need help fixing SceneManager.LoadScene error

Hello, I could do with some help on loading scenes.

I thought that this script below was the propper way of loading scenes in the new unity, however i keep getting the error message; ‘SceneManager’ does not contain a definition for ‘LoadScene’

I don’t know why this won’t work, please help.

using UnityEngine;
using UnityEngine.SceneManagement;
using System.Collections;


public class SceneManager : MonoBehaviour {

	public void SwitchScenes (string SceneToLoad) {
		SceneManager.LoadScene(SceneToLoad);
	}
}

The problem is in reality that your class is the same name as the unity class “SceneManager”. It is trying to call your CUSTOM class and the method called “LoadScene” (which clearly doesn’t exist in your custom implementation of the same named class), either rename your custom class of the same name or fully quality the class and method call with the namespace. Path of least resistance is to call the method(attempt) locally.

example of #2 line 9:

UnityEngine.SceneManagement.SceneManager.LoadScene(SceneToLoad);

I would suggest renaming your custom class so it doesn’t conflict with Unity’s types.