static Autorun() { EditorApplication.update += Update; try { StreamReader reader = new StreamReader("Assets/ARGames/ARGameList.txt"); string[] rows = reader.ReadToEnd().Split('\n'); reader.Close(); for (int i = 0; i < rows.Length; i++) { // add product name to cloud id lookup if (rows[i].EndsWith("\r")) { rows[i] = rows[i].Substring(0, rows[i].Length - 1); } string[] cols = rows[i].Split(','); if (cols.Length > (int)ARGameList.CLOUD_PROJECT_ID) { productNameToCloudProjectId[cols[(int)ARGameList.PRODUCT_NAME]] = cols[(int)ARGameList.CLOUD_PROJECT_ID]; } } } catch (Exception) { singleGameProject = true; } foreach (KeyValuePair <string, string> entry in productNameToCloudProjectId) { // unhide resources folder of current game, hide resources folders of other games bool currentGame = (Application.productName == entry.Key); string folderName = Application.dataPath + "/ARGames/" + DeviceInput.NameToFolderName(entry.Key) + "/Resources"; System.Diagnostics.Process process = new System.Diagnostics.Process(); if ((int)System.Environment.OSVersion.Platform == 4 || (int)System.Environment.OSVersion.Platform == 6) { process.StartInfo.FileName = "chflags"; process.StartInfo.Arguments = (currentGame ? "nohidden \"" : "hidden \"") + folderName + "\""; } else { process.StartInfo.FileName = "attrib.exe"; process.StartInfo.Arguments = (currentGame ? "-h \"" : "+h \"") + folderName.Replace('/', '\\') + "\""; } process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.Start(); process.WaitForExit(); } // force recompile when switching from a different game if (AssetDatabase.IsValidFolder("Assets/_DO NOT COMMIT RIGHT NOW - If Unity crashed, restart it now")) { AssetDatabase.DeleteAsset("Assets/_DO NOT COMMIT RIGHT NOW - If Unity crashed, restart it now"); AssetDatabase.Refresh(); foreach (string asset in AssetDatabase.FindAssets("t:Script")) { string path = AssetDatabase.GUIDToAssetPath(asset); if (path.StartsWith("Assets/") && path != "Assets/AREngine/Editor/Autorun.cs") { AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate); } } } AssetDatabase.Refresh(); CleanUp(); }