`SceneManager' does not contain a definition for `LoadScene'
hi, can someone please help me with this error:
Assets/Menu.cs(53,22): error CS0117: `SceneManager' does not contain a definition for `LoadScene'
here's my script, thanks.
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using UnityEngine.SceneManagement;
public class Menu : MonoBehaviour {
public Canvas quitMenu;
public Canvas instractionsMenu;
public Button startText;
public Button exitText;
public Button instractionsText;
// Use this for initialization
void Start ()
{
quitMenu = quitMenu.GetComponent<Canvas> ();
instractionsMenu = instractionsMenu.GetComponent<Canvas> ();
startText = startText.GetComponent<Button> ();
exitText = exitText.GetComponent<Button> ();
instractionsText = instractionsText.GetComponent<Button> ();
quitMenu.enabled = false;
instractionsMenu.enabled = false;
}
public void ExitPress()
{
quitMenu.enabled = true;
startText.enabled = false;
exitText.enabled = false;
instractionsMenu.enabled = false;
instractionsText.enabled = false;
}
public void NoPress()
{
quitMenu.enabled = false;
startText.enabled = true;
exitText.enabled = true;
instractionsMenu.enabled = false;
instractionsText.enabled = true;
}
public void StartLevel()
{
SceneManager.LoadScene("1");
}
public void ExitGame()
{
Application.Quit ();
}
public void instractionsPress()
{
quitMenu.enabled = false;
startText.enabled = false;
exitText.enabled = false;
instractionsMenu.enabled = true;
instractionsText.enabled = false;
}
}
Application.LoadLevel(n)
Is outdated code! The scene manager probably could not find a scene called 1. So just get rid of the quotation marks around 1:
Scene$$anonymous$$anager.LoadScene(1);
actually my main scene is called just "1".. but Application.LoadLevel(1) worked as well
Answer by pradeepBee · Apr 11, 2016 at 09:22 AM
Try Application.LoadLevel(n); where n is the index of your scene in build settings.
Your answer
Follow this Question
Related Questions
How to Destroy game object horizontally and vertically , when hit by a Raycast 0 Answers
File.Move won't work : IOException: Win32 IO returned ERROR_ALREADY_EXISTS. Path: 0 Answers
WebGL Cardboard VR (GVR) errors 1 Answer
[Help] I keep getting an error with empty message when I create a C# script 1 Answer
Unity 5.6 - Editor Sign In Error 0 Answers