NiceTouch v2.1
MoreMountains.Tools.MMDebug Class Reference

Debug helpers More...

Classes

struct  DebugLogItem
 A struct used to store log items More...
 
struct  MMDebugLogEvent
 An event used to broadcast debug logs More...
 

Static Public Member Functions

static void DebugLogCommand (string command)
 Tries to input a command More...
 
static void DebugLogClear ()
 Clears the debug log More...
 
static void DebugLogTime (object message, string color="", int timePrecision=3, bool displayFrameCount=true)
 Outputs the message object to the console, prefixed with the current timestamp More...
 
static DebugLogItem LogDebugToConsole (object message, string color, int timePrecision, bool displayFrameCount)
 Logs the specified message to the console More...
 
static void SetDebugLogsEnabled (bool status)
 Enables or disables debug logs More...
 
static void SetDebugDrawEnabled (bool status)
 Enables or disables debug draws More...
 
static RaycastHit2D RayCast (Vector2 rayOriginPoint, Vector2 rayDirection, float rayDistance, LayerMask mask, Color color, bool drawGizmo=false)
 Draws a debug ray in 2D and does the actual raycast More...
 
static RaycastHit2D BoxCast (Vector2 origin, Vector2 size, float angle, Vector2 direction, float length, LayerMask mask, Color color, bool drawGizmo=false)
 Does a boxcast and draws a box gizmo More...
 
static RaycastHit2D MonoRayCastNonAlloc (RaycastHit2D[] array, Vector2 rayOriginPoint, Vector2 rayDirection, float rayDistance, LayerMask mask, Color color, bool drawGizmo=false)
 Draws a debug ray without allocating memory More...
 
static RaycastHit Raycast3D (Vector3 rayOriginPoint, Vector3 rayDirection, float rayDistance, LayerMask mask, Color color, bool drawGizmo=false, QueryTriggerInteraction queryTriggerInteraction=QueryTriggerInteraction.UseGlobal)
 Draws a debug ray in 3D and does the actual raycast More...
 
static void DebugOnScreen (string message)
 Instantiates a MMConsole if there isn't one already, and adds the message in parameter to it. More...
 
static void DebugOnScreen (string label, object value, int fontSize=25)
 Instantiates a MMConsole if there isn't one already, and displays the label in bold and its value next to it. More...
 
static void InstantiateOnScreenConsole (int fontSize=25)
 Instantiates the on screen console if there isn't one already More...
 
static void SetOnScreenConsole (MMDebugOnScreenConsole newConsole)
 Use this method to specify what console to use More...
 
static void DrawGizmoArrow (Vector3 origin, Vector3 direction, Color color, float arrowHeadLength=3f, float arrowHeadAngle=25f)
 Draws a gizmo arrow going from the origin position and along the direction Vector3 More...
 
static void DebugDrawArrow (Vector3 origin, Vector3 direction, Color color, float arrowHeadLength=0.2f, float arrowHeadAngle=35f)
 Draws a debug arrow going from the origin position and along the direction Vector3 More...
 
static void DebugDrawArrow (Vector3 origin, Vector3 direction, Color color, float arrowLength, float arrowHeadLength=0.20f, float arrowHeadAngle=35.0f)
 Draws a debug arrow going from the origin position and along the direction Vector3 More...
 
static void DebugDrawCross (Vector3 spot, float crossSize, Color color)
 Draws a debug cross of the specified size and color at the specified point More...
 
static void DrawHandlesBounds (Bounds bounds, Color color)
 Draws handles to materialize the bounds of an object on screen. More...
 
static void DrawSolidRectangle (Vector3 position, Vector3 size, Color borderColor, Color solidColor)
 Draws a solid rectangle at the specified position and size, and of the specified colors More...
 
static void DrawGizmoPoint (Vector3 position, float size, Color color)
 Draws a gizmo sphere of the specified size and color at a position More...
 
static void DrawCube (Vector3 position, Color color, Vector3 size)
 Draws a cube at the specified position, and of the specified color and size More...
 
static void DrawGizmoCube (Transform transform, Vector3 offset, Vector3 cubeSize, bool wireOnly)
 Draws a cube at the specified position, offset, and of the specified size More...
 
static void DrawGizmoRectangle (Vector2 center, Vector2 size, Color color)
 Draws a gizmo rectangle More...
 
static void DrawGizmoRectangle (Vector2 center, Vector2 size, Matrix4x4 rotationMatrix, Color color)
 Draws a gizmo rectangle More...
 
static void DrawRectangle (Rect rectangle, Color color)
 Draws a rectangle based on a Rect and color More...
 
static void DrawRectangle (Vector3 position, Color color, Vector3 size)
 Draws a rectangle of the specified color and size at the specified position More...
 
static void DrawPoint (Vector3 position, Color color, float size)
 Draws a point of the specified color and size at the specified position More...
 
static void DrawGizmoPoint (Vector3 position, Color color, float size)
 Draws a line of the specified color and size using gizmos More...
 
static string GetSystemInfo ()
 
static void ClearConsole ()
 

Static Public Attributes

static List< DebugLogItemLogHistory = new List<DebugLogItem>(_logHistoryMaxLength)
 A list of all the debug logs (up to DebugLogMaxLength entries) More...
 
static MMDebugOnScreenConsole _console
 

Properties

static MethodInfo[] Commands [get]
 Returns a list of all the debug command lines found in the project's assemblies More...
 
static string LogHistoryText [get]
 Returns a string with all log history condensed More...
 
static bool? DebugLogsEnabled [get]
 whether or not debug logs (MMDebug.DebugLogTime, MMDebug.DebugOnScreen) should be displayed More...
 
static bool DebugDrawEnabled [get]
 whether or not debug draws should be executed More...
 

Detailed Description

Debug helpers

Member Function Documentation

◆ BoxCast()

static RaycastHit2D MoreMountains.Tools.MMDebug.BoxCast ( Vector2  origin,
Vector2  size,
float  angle,
Vector2  direction,
float  length,
LayerMask  mask,
Color  color,
bool  drawGizmo = false 
)
static

Does a boxcast and draws a box gizmo

Parameters
origin
size
angle
direction
length
mask
color
drawGizmo
Returns

◆ ClearConsole()

static void MoreMountains.Tools.MMDebug.ClearConsole ( )
static

◆ DebugDrawArrow() [1/2]

static void MoreMountains.Tools.MMDebug.DebugDrawArrow ( Vector3  origin,
Vector3  direction,
Color  color,
float  arrowHeadLength = 0.2f,
float  arrowHeadAngle = 35f 
)
static

Draws a debug arrow going from the origin position and along the direction Vector3

Parameters
originOrigin.
directionDirection.
colorColor.

◆ DebugDrawArrow() [2/2]

static void MoreMountains.Tools.MMDebug.DebugDrawArrow ( Vector3  origin,
Vector3  direction,
Color  color,
float  arrowLength,
float  arrowHeadLength = 0.20f,
float  arrowHeadAngle = 35.0f 
)
static

Draws a debug arrow going from the origin position and along the direction Vector3

Parameters
originOrigin.
directionDirection.
colorColor.
arrowLengthArrow length.
arrowHeadLengthArrow head length.
arrowHeadAngleArrow head angle.

◆ DebugDrawCross()

static void MoreMountains.Tools.MMDebug.DebugDrawCross ( Vector3  spot,
float  crossSize,
Color  color 
)
static

Draws a debug cross of the specified size and color at the specified point

Parameters
spotSpot.
crossSizeCross size.
colorColor.

◆ DebugLogClear()

static void MoreMountains.Tools.MMDebug.DebugLogClear ( )
static

Clears the debug log

◆ DebugLogCommand()

static void MoreMountains.Tools.MMDebug.DebugLogCommand ( string  command)
static

Tries to input a command

Parameters
command

◆ DebugLogTime()

static void MoreMountains.Tools.MMDebug.DebugLogTime ( object  message,
string  color = "",
int  timePrecision = 3,
bool  displayFrameCount = true 
)
static

Outputs the message object to the console, prefixed with the current timestamp

Parameters
messageMessage.

◆ DebugOnScreen() [1/2]

static void MoreMountains.Tools.MMDebug.DebugOnScreen ( string  label,
object  value,
int  fontSize = 25 
)
static

Instantiates a MMConsole if there isn't one already, and displays the label in bold and its value next to it.

Parameters
labelLabel.
valueValue.
fontSizeThe optional font size.

◆ DebugOnScreen() [2/2]

static void MoreMountains.Tools.MMDebug.DebugOnScreen ( string  message)
static

Instantiates a MMConsole if there isn't one already, and adds the message in parameter to it.

Parameters
messageMessage.

◆ DrawCube()

static void MoreMountains.Tools.MMDebug.DrawCube ( Vector3  position,
Color  color,
Vector3  size 
)
static

Draws a cube at the specified position, and of the specified color and size

Parameters
positionPosition.
colorColor.
sizeSize.

◆ DrawGizmoArrow()

static void MoreMountains.Tools.MMDebug.DrawGizmoArrow ( Vector3  origin,
Vector3  direction,
Color  color,
float  arrowHeadLength = 3f,
float  arrowHeadAngle = 25f 
)
static

Draws a gizmo arrow going from the origin position and along the direction Vector3

Parameters
originOrigin.
directionDirection.
colorColor.

◆ DrawGizmoCube()

static void MoreMountains.Tools.MMDebug.DrawGizmoCube ( Transform  transform,
Vector3  offset,
Vector3  cubeSize,
bool  wireOnly 
)
static

Draws a cube at the specified position, offset, and of the specified size

Parameters
transform
offset
cubeSize
wireOnly

◆ DrawGizmoPoint() [1/2]

static void MoreMountains.Tools.MMDebug.DrawGizmoPoint ( Vector3  position,
Color  color,
float  size 
)
static

Draws a line of the specified color and size using gizmos

Parameters
position
color
size

◆ DrawGizmoPoint() [2/2]

static void MoreMountains.Tools.MMDebug.DrawGizmoPoint ( Vector3  position,
float  size,
Color  color 
)
static

Draws a gizmo sphere of the specified size and color at a position

Parameters
positionPosition.
sizeSize.
colorColor.

◆ DrawGizmoRectangle() [1/2]

static void MoreMountains.Tools.MMDebug.DrawGizmoRectangle ( Vector2  center,
Vector2  size,
Color  color 
)
static

Draws a gizmo rectangle

Parameters
centerCenter.
sizeSize.
colorColor.

◆ DrawGizmoRectangle() [2/2]

static void MoreMountains.Tools.MMDebug.DrawGizmoRectangle ( Vector2  center,
Vector2  size,
Matrix4x4  rotationMatrix,
Color  color 
)
static

Draws a gizmo rectangle

Parameters
centerCenter.
sizeSize.
colorColor.

◆ DrawHandlesBounds()

static void MoreMountains.Tools.MMDebug.DrawHandlesBounds ( Bounds  bounds,
Color  color 
)
static

Draws handles to materialize the bounds of an object on screen.

Parameters
boundsBounds.
colorColor.

◆ DrawPoint()

static void MoreMountains.Tools.MMDebug.DrawPoint ( Vector3  position,
Color  color,
float  size 
)
static

Draws a point of the specified color and size at the specified position

Parameters
posPosition.
colCol.
scaleScale.

◆ DrawRectangle() [1/2]

static void MoreMountains.Tools.MMDebug.DrawRectangle ( Rect  rectangle,
Color  color 
)
static

Draws a rectangle based on a Rect and color

Parameters
rectangleRectangle.
colorColor.

◆ DrawRectangle() [2/2]

static void MoreMountains.Tools.MMDebug.DrawRectangle ( Vector3  position,
Color  color,
Vector3  size 
)
static

Draws a rectangle of the specified color and size at the specified position

Parameters
positionPosition.
colorColor.
sizeSize.

◆ DrawSolidRectangle()

static void MoreMountains.Tools.MMDebug.DrawSolidRectangle ( Vector3  position,
Vector3  size,
Color  borderColor,
Color  solidColor 
)
static

Draws a solid rectangle at the specified position and size, and of the specified colors

Parameters
position
size
borderColor
solidColor

◆ GetSystemInfo()

static string MoreMountains.Tools.MMDebug.GetSystemInfo ( )
static

◆ InstantiateOnScreenConsole()

static void MoreMountains.Tools.MMDebug.InstantiateOnScreenConsole ( int  fontSize = 25)
static

Instantiates the on screen console if there isn't one already

◆ LogDebugToConsole()

static DebugLogItem MoreMountains.Tools.MMDebug.LogDebugToConsole ( object  message,
string  color,
int  timePrecision,
bool  displayFrameCount 
)
static

Logs the specified message to the console

Parameters
message
color
timePrecision
displayFrameCount
Returns

◆ MonoRayCastNonAlloc()

static RaycastHit2D MoreMountains.Tools.MMDebug.MonoRayCastNonAlloc ( RaycastHit2D[]  array,
Vector2  rayOriginPoint,
Vector2  rayDirection,
float  rayDistance,
LayerMask  mask,
Color  color,
bool  drawGizmo = false 
)
static

Draws a debug ray without allocating memory

Returns
The ray cast non alloc.
Parameters
arrayArray.
rayOriginPointRay origin point.
rayDirectionRay direction.
rayDistanceRay distance.
maskMask.
colorColor.
drawGizmoIf set to true draw gizmo.

◆ RayCast()

static RaycastHit2D MoreMountains.Tools.MMDebug.RayCast ( Vector2  rayOriginPoint,
Vector2  rayDirection,
float  rayDistance,
LayerMask  mask,
Color  color,
bool  drawGizmo = false 
)
static

Draws a debug ray in 2D and does the actual raycast

Returns
The raycast hit.
Parameters
rayOriginPointRay origin point.
rayDirectionRay direction.
rayDistanceRay distance.
maskMask.
debugIf set to true debug.
colorColor.

◆ Raycast3D()

static RaycastHit MoreMountains.Tools.MMDebug.Raycast3D ( Vector3  rayOriginPoint,
Vector3  rayDirection,
float  rayDistance,
LayerMask  mask,
Color  color,
bool  drawGizmo = false,
QueryTriggerInteraction  queryTriggerInteraction = QueryTriggerInteraction.UseGlobal 
)
static

Draws a debug ray in 3D and does the actual raycast

Returns
The raycast hit.
Parameters
rayOriginPointRay origin point.
rayDirectionRay direction.
rayDistanceRay distance.
maskMask.
debugIf set to true debug.
colorColor.
drawGizmoIf set to true draw gizmo.

◆ SetDebugDrawEnabled()

static void MoreMountains.Tools.MMDebug.SetDebugDrawEnabled ( bool  status)
static

Enables or disables debug draws

Parameters
status

◆ SetDebugLogsEnabled()

static void MoreMountains.Tools.MMDebug.SetDebugLogsEnabled ( bool  status)
static

Enables or disables debug logs

Parameters
status

◆ SetOnScreenConsole()

static void MoreMountains.Tools.MMDebug.SetOnScreenConsole ( MMDebugOnScreenConsole  newConsole)
static

Use this method to specify what console to use

Parameters
newConsole

Member Data Documentation

◆ _console

MMDebugOnScreenConsole MoreMountains.Tools.MMDebug._console
static

◆ LogHistory

List<DebugLogItem> MoreMountains.Tools.MMDebug.LogHistory = new List<DebugLogItem>(_logHistoryMaxLength)
static

A list of all the debug logs (up to DebugLogMaxLength entries)

Property Documentation

◆ Commands

MethodInfo [] MoreMountains.Tools.MMDebug.Commands
staticget

Returns a list of all the debug command lines found in the project's assemblies

◆ DebugDrawEnabled

bool MoreMountains.Tools.MMDebug.DebugDrawEnabled
staticget

whether or not debug draws should be executed

◆ DebugLogsEnabled

bool? MoreMountains.Tools.MMDebug.DebugLogsEnabled
staticget

whether or not debug logs (MMDebug.DebugLogTime, MMDebug.DebugOnScreen) should be displayed

◆ LogHistoryText

string MoreMountains.Tools.MMDebug.LogHistoryText
staticget

Returns a string with all log history condensed


The documentation for this class was generated from the following file: