把一個資料夾下的東西,依深度,全部翻一次
Sample 是找到 m_SerializedLevelName 的 scene 為止.
private string FindScene() { Stack<string> searchFolders = new Stack<string>(); searchFolders.Push("Assets"); while (searchFolders.Count > 0) { string searchDir = searchFolders.Pop(); string pathToCheck = searchDir+"/"+m_SerializedLevelName+".unity"; if (File.Exists(pathToCheck)) return pathToCheck; else foreach (string dir in Directory.GetDirectories(searchDir)) searchFolders.Push(dir); } return null; }