using Scenemanager
I'm new to coding as it is, then when i find out i have to use this whole "scenemanager" i am literally pulling my hair out trying to work it out.
Basically i have a pause menu in the game which functions however, i want to be able to go back to the main menu of the game using it. so i am trying to load the scene and close the current one if the user presses the button.
public static void LoadScene() { //SceneManager.GetActiveScene (mainMenu); if( SceneManager.GetActiveScene(mainMenu).buildIndex==1 ) { } print ("To main Menu"); }
Excuse the "messiness" of it. The main menu scene i want to go to is called "mainMenu" if that helps.
I Honestly have no idea how to do this. Any help would be appreciated.
Answer by FortisVenaliter · May 20, 2016 at 03:04 PM
How about this:
SceneManager.LoadScene("mainMenu");
@FortisVenaliter That isnt giving me any errors now however i get this in unity now.
before it just said "pause $$anonymous$$enu.LoadScene".
Well, did you remove that function from the Pause_$$anonymous$$enu class, or change the signature of that function?
Sorry about that. somehow a little unity restart fixed it. Thanks for your help!