Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- /// <summary>
- /// Conditional testing statements that only function within the Editor (They get Stripped out of the iPhone Build)
- /// </summary>
- public class Assert
- {
- /// <summary>
- /// Tests a Comparison, and if false, will display the message. This function only works within the Editor (it is ignored on the iPhone)
- /// </summary>
- /// <param name='comparison'>
- /// The comparison to test
- /// </param>
- /// <param name='message'>
- /// The message to Display
- /// </param>
- [System.Diagnostics.Conditional("UNITY_EDITOR")]
- public static void Test(bool comparison, string message)
- {
- if(!comparison)
- {
- Assert.Throw(message);
- }
- }
- /// <summary>
- /// Tests a Comparison, and if false, will display the message. This function only works within the Editor (it is ignored on the iPhone)
- /// </summary>
- /// <param name='comparison'>
- /// The comparison to test
- /// </param>
- /// <param name='message'>
- /// The message to Display
- /// </param>
- [System.Diagnostics.Conditional("UNITY_EDITOR")]
- public static void Test(bool comparison, string message, Object callingObject)
- {
- if(!comparison)
- {
- Assert.Throw(message, callingObject);
- }
- }
- /// <summary>
- /// Throw the specified message.
- /// </summary>
- /// <param name='message'>
- /// Message.
- /// </param>
- [System.Diagnostics.Conditional("UNITY_EDITOR")]
- public static void Throw(string message)
- {
- Debug.LogWarning(message);
- Debug.Break();
- }
- /// <summary>
- /// Throw the specified message and the object that has called it.
- /// </summary>
- /// <param name='message'>
- /// Message.
- /// </param>
- /// <param name='callingObject'>
- /// Calling object.
- /// </param>
- [System.Diagnostics.Conditional("UNITY_EDITOR")]
- public static void Throw(string message, Object callingObject)
- {
- Debug.LogWarning(message, callingObject);
- Debug.Break();
- }
- /// <summary>
- /// Log the specified message along with a formatted date.
- /// </summary>
- /// <param name='message'>
- /// Message.
- /// </param>
- [System.Diagnostics.Conditional("UNITY_EDITOR")]
- public static void Log(string message)
- {
- Debug.Log(string.Format("{0:HH:mm:ss FFFF} ->" + message, System.DateTime.Now));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement