//Unity calls this function for us (before Start()) void Awake() { if (Instance != null) //When loading 'this' Menu Manager, if an Instance already exists { Destroy(gameObject); //Destroy this game object } else //If no instance has been created yet... { Instance = this; //We need to initialize the Instance variable DontDestroyOnLoad(gameObject); //Call this unity function to save an data transferring from scene to scene RenderedPages = new List<Page>(); AddPage(entry); StartCoroutine("UpdateMenu", 0.25f); //Update the menu every quarter second. } }
//Unity calls this function for us void Start() { menu = GameObject.FindGameObjectWithTag("MenuManager").GetComponent<MenuManager1>(); }