Material Clustering Benchmark
Diagnostics.cs
Go to the documentation of this file.
1public static class Diagnostics
2{
3 /// <summary>
4 /// If <paramref name="val" /> is false, throws a <see cref="System.Exception" /> with the <paramref name="message" />.
5 /// </summary>
6 /// <param name="val">Checks if this value is true.</param>
7 /// <param name="message">Message for the thrown exception.</param>
8 public static void Assert(bool val, string message)
9 {
10 if (!val)
11 {
12 Throw(message);
13 }
14 }
15
16 /// <summary>
17 /// If <paramref name="val" /> is false, throws <paramref name="exception" />.
18 /// </summary>
19 /// <param name="val">Checks if this value is true.</param>
20 /// <param name="exception">Exception to throw.</param>
21 public static void Assert(bool val, System.Exception exception)
22 {
23 if (!val)
24 {
25 Throw(exception);
26 }
27 }
28
29 public static void Throw(System.Exception exception)
30 {
31#if UNITY_EDITOR
32 UnityEditor.EditorApplication.isPlaying = false;
33 throw exception;
34#else
35 System.IO.File.WriteAllText("Error.txt", exception.ToString());
36 UnityEngine.Application.Quit();
37#endif
38 }
39
40 public static void Throw(string message)
41 {
42 Throw(new System.Exception(message));
43 }
44}
static void Assert(bool val, System.Exception exception)
If val is false, throws exception .
Definition: Diagnostics.cs:21
static void Throw(string message)
Definition: Diagnostics.cs:40
static void Throw(System.Exception exception)
Definition: Diagnostics.cs:29
static void Assert(bool val, string message)
If val is false, throws a System.Exception with the message .
Definition: Diagnostics.cs:8