/* Creates UI for main menu and renders menu cell in the background. * Warning: Is hardcoded with project-specific variables. */ public void CreateMenu() { Cursor.visible = false; string MENU_BUILDING = "House"; string MENU_INTERIOR = "Entrance"; GameObject go = new GameObject(); sesCam = go.AddComponent(typeof(Camera)) as Camera; sesMenu = go.AddComponent(typeof(MenuManager)) as MenuManager; go.AddComponent <AudioListener>(); sesMenu.Change("MAIN"); jukeBox.Play("Menu"); }
// Create a static instance. void Awake() { if (Instance == null) { Instance = this; // Make sure this object isn't destroyed when a new scene is loaded. DontDestroyOnLoad(this.gameObject); // Play the music. OnLevelWasLoaded(0); } else { // Play the music. Instance.Play(this.clip); DestroyImmediate(gameObject); } }