Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
The script for the Main Menu.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//This package contains the commands for loading different scenes
using UnityEngine.SceneManagement;
public class MainMenuScript : MonoBehaviour
//This function starts the game by loading the scene with all our gameobjects
public void StartGame(){
//This function quiets the game by calling Application.Quit()
public void QuitGame(){
//This is a coroutine. While how it works is somewhat vague, what it does is pauses the game until the scene is done loading
//This makes performance in terms of computing much easier
IEnumerator StartLoadingScene(){
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync("TestScene");
yield return null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment