Im trying to make a simple mainmenu and Im stuck at a button that I called “newgamebutton”.
Its supposed to start the game after you clicked it (with a left mouseclick), changing the scene from the mainmenu-scene that I called “mainmenu” to another scene that I named “newgame”.
I tried a few different aproaches, but none of them worked. I saw some tutorials and tried to replicate it 1:1 with no success. I deleted everything and now I just pressed add component in the inspector menu of my button “newgamebutton” and put the script that I named “newgamebuttonscript” there. It contains this code:
using UnityEngine;
using System.Collections;
public class newgamebuttonscript : MonoBehaviour {
void OnMouseDown() {
Play();
}
void Play() {
Application.LoadLevel(“newgame”);
}
}
I put the scenes in the build menu: 0 is mainmenu and newgame is 1.
I just downloaded unity and I use the program “Microsoft Visual Studio Code” with it.
What do I have to do now and what do I have to change?
I didnt put anything in the newgamescene so if it works, everything should just turn blue bc thats how the game-mode displays the nothingness of that scene.
heres a screenshot: