Beispiel #1
0
    private void OnGUI()
    {
        worlds = (WorldsInfo)EditorGUILayout.ObjectField(worlds, typeof(WorldsInfo), false);
        if (GUILayout.Button("Update worlds"))
        {
            string[] levelFolders = Directory.GetDirectories("Assets/Resources/Levels");


            List <string> worldNames = new List <string>();
            for (int i = 0; i < levelFolders.Length; i++)
            {
                var    split      = levelFolders[i].Split(new char[] { '\\' });
                string folderName = split[split.Length - 1];
                string folderPath = split[0];
                worldNames.Add(folderName);
                LevelInfo[] l = Resources.LoadAll <LevelInfo>("Levels/" + folderName);
                for (int li = 0; li < l.Length; li++)
                {
                    l[li].world = i;
                }
            }
            //TODO: FIX scenename!!!!!!!

            worlds.worldNames = worldNames;
            AssetDatabase.SaveAssets();
        }
    }
Beispiel #2
0
 /// <summary>
 /// Startup operations.
 /// </summary>
 internal static void StartUp()
 {
     WorldsInfo.Cache();
 }