Update tools window
This commit is contained in:
parent
1f2c251d0c
commit
f3f386d4c0
@ -57,17 +57,31 @@ namespace NegUtils.Editor
|
||||
var menu = new GenericMenu();
|
||||
|
||||
string path = Application.dataPath + "/Scenes/Production";
|
||||
string[] fileInfo = Directory.GetFiles(path, "*.unity");
|
||||
|
||||
foreach (string item in fileInfo)
|
||||
AddFiles(path, path, menu);
|
||||
|
||||
menu.DropDown(position);
|
||||
}
|
||||
|
||||
private static void AddFiles(string path, string basePath, GenericMenu menu)
|
||||
{
|
||||
string s = item;
|
||||
menu.AddItem(new GUIContent(s.Remove(0, path.Length + 1).Remove(s.Length - path.Length - 7 ,6)), false, () => {
|
||||
string[] fileInfo = Directory.GetFiles(path, "*.unity");
|
||||
for (int i = 0; i < fileInfo.Length; i++)
|
||||
{
|
||||
string s = fileInfo[i];
|
||||
menu.AddItem(new GUIContent(s.Remove(0, basePath.Length + 1).Remove(s.Length - basePath.Length - 7 ,6).Replace('\\', '/')), false, () => {
|
||||
LoadScene(s);
|
||||
});
|
||||
|
||||
if(i == fileInfo.Length) continue;
|
||||
menu.AddSeparator("");
|
||||
}
|
||||
menu.DropDown(position);
|
||||
|
||||
string[] dirInfo = Directory.GetDirectories(path);
|
||||
foreach (string dir in dirInfo)
|
||||
{
|
||||
AddFiles(dir, basePath, menu);
|
||||
}
|
||||
}
|
||||
|
||||
private static void LoadScene(string path)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user