//format the string and print it out public static void log(int type, object str, int lvl, GameObject context) { //Debug.Log("Debugger settings:"+debuggerActive+", "+debugLevel+", "+importantGO+", "+debugFlags); str = str.ToString(); if (!debuggerActive) { //using debugger through other than editor Debug.Log(type + "> " + str); return; } //are levels set? int minLvl = debugLevel; if (lvl > minLvl) { return; } //get object's name string objInfo = " "; if (context) { objInfo += context.transform.root.gameObject.name; //if context is _fog_of_war, then it's obviously fog of war if (objInfo == " _Fog of war") { type = (int)cat.FOGOFWAR; } } //color it string myColor = colors[type]; //mark it as red (if this is important object) if (context != null) { if (context.name == importantGO || context.transform.root.gameObject.name == importantGO) { myColor = colors[0]; } } //are flags on for this type? int layer = 1 << type; if ((debugFlags & layer) == 0) { return; } //create indentation depending on the debugLevel string tabs = ""; for (int t = 1; t <= lvl; t++) { tabs += "\t- "; } tabs += "-{" + lvl + "} "; //get category name as string cat typeName = ((cat)type); string typeNameString = typeName.ToString(); //format str = "<color=#" + myColor + ">" + "[" + typeNameString + "] " + tabs + "<b>" + str + "</b>" + "<i>\t\t\t[" + objInfo + "]</i>" + "</color>"; //print it out Debug.Log(str, context); }