Debugging

Abhishek Smith

Abhishek Smith

Building Outscal | Land Jobs in the gaming industry | EA, Epic Games, TCS, | CMU, IIT K

Console Debugging

  • Debug.Log(): For general info tracking
  • Debug.LogWarning(): Non-critical issues
  • Debug.LogError(): Critical problems
  • Debug.LogAssertion(): Condition validation
  • Debug.LogException(): Exception tracking

Scene View Debugging

  • Debug.DrawLine(): Visualize connections & paths
  • Debug.DrawRay(): Show raycasts & sight lines
  • OnDrawGizmos(): Always visible scene markers
  • OnDrawGizmosSelected(): Selected object markers

Performance Profiling

  • ProfilerMarker: Modern, low-overhead profiling
  • Profiler.BeginSample: Legacy but flexible
  • Editor Profiler Window: Deep performance analysis

Physics Debugging

  • Physics.IgnoreCollision(): Ignore collisions between specific objects
  • Physics.OverlapSphere(): Check for objects in a given radius

Network & Input Debugging

  • Application.internetReachability: Check network connectivity
  • SystemInfo.deviceName: Log the current device’s name
  • Input.GetKeyDown(): Track keypresses during gameplay
  • Input.mousePosition: Log mouse position for UI debugging

Pro Tips:

  • Never leave Debug.Logs in production builds
  • Use conditional compilation for debug code
  • Keep Gizmos clean and organized
  • Profile specific sections, not entire methods

Common Mistakes:

  • Debug spam in Update() methods
  • Forgetting to remove debug code
  • Using wrong log levels
  • Not cleaning up profiler markers
  • Over-relying on console logs

Show More