- Home /
[C#] Unity asks for a } for a reason I don't know ( '}' expected )
I've tried a bunch of fixes to this but none have worked, I feel that this is a rather simple fix. Any help?
 using UnityEngine;
 using System.Collections;
 using UnityEngine.SceneManagement;
 
 public class toMainMenu : MonoBehaviour {
 
     void Update( )
     {
         if( Input.GetKeyUp( KeyCode.Escape ) ){
             SceneManager.LoadScene(string MainMenu1);
         }
 
Answer by tanoshimi · Oct 09, 2016 at 06:15 PM
Brackets come in pairs - an open and a close. Right now, your code has 3 opening curly brackets, and only one closing curly bracket. So put two more } at the end.
So, I did try this when I got back from what I was doing. It however didn't work. I dubbed this the best answer since it currently is the only answer.
That line should probably read:
 Scene$$anonymous$$anager.LoadScene("$$anonymous$$ain$$anonymous$$enu1");
Thank you ByteSheep! That worked! The only reason it had string and no quotations was because I was making a function for the main menu to load a scene and mixed up the parameters of the function with loading the actual scene since I use my other scripts as reference, thanks!
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                