void Update() { if (Debug.isDebugBuild && _hideDevConsole && Debug.developerConsoleVisible) { Debug.ClearDeveloperConsole(); } #if !UNITY_WEBGL if (_isPinging) { if (_time > _pingTimeout) { Debug.Log("ping timeout (" + _ping.ip + ")"); _ping = null; _isPinging = false; } else if (_ping.isDone) { Debug.Log("pong! (" + _ping.ip + ": " + _ping.time + "ms)"); _ping = null; _isPinging = false; } _time += Time.deltaTime; } #endif if (_planRestart && _lastTime.TimeOfDay < _restartDate.TimeOfDay && DateTime.Now.TimeOfDay >= _restartDate.TimeOfDay) { restartProcess(); } _lastTime = DateTime.Now; }
private static bool IsError(string err) { if (string.IsNullOrEmpty(err)) { return(false); } Debug.ClearDeveloperConsole(); UpdateProgress(0, true); EditorUtility.DisplayDialog("Build Error", "A fatal error occurred while building the " + currentBuild + " build. Please see the console for more details", "OK", null); return(true); }
public static void ClearDeveloperConsole() { Debug.ClearDeveloperConsole(); }
public static void BuildAll() { try { Debug.ClearDeveloperConsole(); Application.SetStackTraceLogType(LogType.Error, StackTraceLogType.None); //Clear builds dir ( so Unity won't cry c: ) try { if (Directory.Exists(BASE_PATH)) { Directory.Delete(BASE_PATH, true); } Directory.CreateDirectory(BASE_PATH); } catch (Exception e) { Debug.LogError($"[Build] Error while clearing {BASE_PATH} : {e.Message}\nPlease restart Unity. If that does not fix the problem, then you're f****d :D"); throw e; } zipMutex = new object(); BuildPlayerOptions opt = new BuildPlayerOptions(); opt.scenes = SceneManager.GetAllScenes().Select(t => t.path).ToArray(); zipper = new FastZip(); string lastErr = ""; //win = EditorBuildAllWindow.OpenWindow(); // WINDOWS currentBuild = "windows"; opt.target = BuildTarget.StandaloneWindows; opt.locationPathName = WINDOWS_BASE_PATH + @"\player.exe"; lastErr = BuildPipeline.BuildPlayer(opt); if (IsError(lastErr)) { return; } ZipInNewThread(WINDOWS_BASE_PATH + ".zip", WINDOWS_BASE_PATH, true, "", "Win", "/Windows.zip", LogPlatform.Windows).Join(); // MAC currentBuild = "osx"; opt.target = BuildTarget.StandaloneOSX; opt.locationPathName = OSX_BASE_PATH + ".app"; lastErr = BuildPipeline.BuildPlayer(opt); if (IsError(lastErr)) { return; } ZipInNewThread(OSX_BASE_PATH + ".zip", OSX_BASE_PATH + ".app", true, "", "Mac", "/Mac.zip", LogPlatform.Mac); // LINUX currentBuild = "linux"; opt.target = BuildTarget.StandaloneLinuxUniversal; opt.locationPathName = LINUX_BASE_PATH + @"\player.x86"; lastErr = BuildPipeline.BuildPlayer(opt); if (IsError(lastErr)) { return; } Thread lin = ZipInNewThread(LINUX_BASE_PATH + ".zip", LINUX_BASE_PATH, true, "", "Lin", "/Linux.zip", LogPlatform.Linux); UpdateProgress(.5f, false, "Awaiting final zip for linux", "Waiting for completion"); //Block the method until the last zip operation has completed (so Unity wont F**K ME OVER!!! (fuk u unity)) lin.Join(); UpdateProgress(0, true); EditorUtility.DisplayDialog("Build Done!", "All builds have been completed", "OK"); } finally { Application.SetStackTraceLogType(LogType.Error, StackTraceLogType.ScriptOnly); } }
private void executeDebug(string[] args) { if (args.Length == 0) { Debug.Log(""); } else { string message = string.Join(" ", args, 1, args.Length - 1); switch (args[0]) { case "-a": Debug.LogAssertion(message, this); break; case "-e": Debug.LogError(message, this); break; case "-x": Debug.LogException(new Exception(message), this); break; case "-l": Debug.Log(message, this); break; case "-w": Debug.LogWarning(message, this); break; case "-B": Debug.Break(); break; case "-V": Debug.Log(Debug.developerConsoleVisible); break; case "-C": Debug.ClearDeveloperConsole(); break; case "-D": Debug.Log(Debug.isDebugBuild); break; case "-H": if (args.Length == 1) { Debug.Log(_hideDevConsole); } else if (args.Length == 2) { bool hideDevConsole = Utils.BoolParse(args[1]); _hideDevConsole = hideDevConsole; } else { throw new SyntaxException(); } break; case "-L": if (args.Length == 3) { if (Utils.TryParseVector3(args[1], NumberStyles.Float, CultureInfo.InvariantCulture, out Vector3 start) && Utils.TryParseVector3(args[2], NumberStyles.Float, CultureInfo.InvariantCulture, out Vector3 end) ) { Debug.DrawLine(start, end, Color.black, 10f, false); } else { Debug.LogError("cannot parse \'" + args[1] + "\' to Vector3"); } } else { throw new SyntaxException(); } break; case "-R": if (args.Length == 3) { if (Utils.TryParseVector3(args[1], NumberStyles.Float, CultureInfo.InvariantCulture, out Vector3 start) && Utils.TryParseVector3(args[2], NumberStyles.Float, CultureInfo.InvariantCulture, out Vector3 dir) ) { Debug.DrawRay(start, dir, Color.black, 10f, false); } else { Debug.LogError("cannot parse \'" + args[1] + "\' to Vector3"); } } else { throw new SyntaxException(); } break; case "-G": int size = 64; Color color = Color.grey; float duration = 10f; bool depthTest = false; for (int i = 1 - size; i < size; i++) { Debug.DrawLine(new Vector3(-size, 0f, i), new Vector3(size, 0f, i), color, duration, depthTest); Debug.DrawLine(new Vector3(i, 0f, -size), new Vector3(i, 0f, size), color, duration, depthTest); } break; default: Debug.Log(string.Join(" ", args, 0, args.Length)); break; } } }