Game development

Stage 2 · Lesson 7 of 7

Debugging games

Programming for games

Game bugs are often visual or about timing, so debug by seeing what happens. Print values to the console. Pause the game on , lines in your code editor where the program stops so you can inspect values.

Draw debug lines, shapes and text in the game view, such as rays, , paths and velocities. Engines help here. has Debug.Log and Debug.DrawRay, has print and a visible collision shapes option, and Unreal has UE_LOG and DrawDebugLine.

Learn to attach the and step through a frame one line at a time. Always make a bug happen reliably before you try to fix it.

Common trapleaving hundreds of log lines printing every frame, which slows the game and buries the one message you need.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

  • CourseFree
    Unity Learn: Junior Programmer Pathway

    Unity Technologies · Beginner

    Unity's official free C# pathway, with small playable projects in every unit

  • GuideFree
    Learn C#

    Microsoft · Beginner

    Microsoft's free C# lessons, for the language itself when Unity code feels unfamiliar

Practise

  • Free mentored exercises in C# and C++ to strengthen the language outside the engine

Keep handy

Also worth your time

Mark this stage as not done?