Warning.cs 747 B

1234567891011121314151617181920212223242526272829
  1. using UnityEngine;
  2. using System.Collections;
  3. namespace RootMotion {
  4. /// <summary>
  5. /// Manages warning messages.
  6. /// </summary>
  7. public static class Warning {
  8. public static bool logged;
  9. public delegate void Logger(string message);
  10. public static void Log(string message, Logger logger, bool logInEditMode = false) {
  11. if (!logInEditMode && !Application.isPlaying) return;
  12. if (logged) return;
  13. if (logger != null) logger(message);
  14. logged = true;
  15. }
  16. public static void Log(string message, Transform context, bool logInEditMode = false) {
  17. if (!logInEditMode && !Application.isPlaying) return;
  18. if (logged) return;
  19. Debug.LogWarning(message, context);
  20. logged = true;
  21. }
  22. }
  23. }