//Called when the scene starts. void LoadMaps () { TextAsset[] m = Resources.LoadAll<TextAsset>("Maps"); //Loads all the maps in as TextAssets from the resources folder. maps = new string[m.Length]; //Sets the maps variable to be the same length as m. for(int x = 0; x < m.Length-2; x++){ //Loops through all the maps. maps[x] = m[x].name; //Sets the maps variable to be an array of all the map names. } ui.LoadMapButtons(maps); //Calls the LoadMapButtons function in the MenuUI.cs script, sending over the array of maps. }