Advertisement
Guest User

Colourful unity debug logs

a guest
Feb 26th, 2020
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public static class Deboogie {
  6.     public static void Log(string s) {
  7.         Debug.Log(BoogieString(s));
  8.     }
  9.     public static void Log(string s, Object context) {
  10.         Debug.Log(BoogieString(s), context);
  11.     }
  12.     public static void LogError(string s) {
  13.         Debug.LogError("<b><i>" + BoogieString(s) + "</i></b>");
  14.     }
  15.     public static void LogError(string s, Object context) {
  16.         Debug.Log("<b><i>" + BoogieString(s) + "</i></b>", context);
  17.     }
  18.     private static string BoogieString(string s) {
  19.         string returnString = "";
  20.  
  21.         Color randCol = Color.white;
  22.         for (int i=0; i<s.Length; i++) {
  23.             randCol = Random.ColorHSV(0f, 1f, 1f, 1f, 0.2f, 0.6f);
  24.  
  25.             returnString += "<color=\"#" + ColorUtility.ToHtmlStringRGB(randCol) + "\">" + s.Substring(i, 1) + "</color>";
  26.         }
  27.  
  28.         return returnString;
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement