Skip to content

Instantly share code, notes, and snippets.

@Rovsau
Last active April 14, 2023 01:55
Show Gist options
  • Save Rovsau/c20f486b0de831dc96f96793c645ea89 to your computer and use it in GitHub Desktop.
Save Rovsau/c20f486b0de831dc96f96793c645ea89 to your computer and use it in GitHub Desktop.
Debug logs with any range of color.
public static class DebugColors
{
public static void Log(Color color, string message, UnityEngine.Object context = default)
{
UnityEngine.Debug.Log($"<color={ColorToHex(color)}>{message}</color>", context);
}
public static string ColorToHex(Color32 color)
{
return $"#{color.r:X2}{color.g:X2}{color.b:X2}";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment