Debugging
The console
The Console panel shows everything the engine and your scripts log. Warnings are yellow and errors red. The buttons hide and show each level, and the filter box keeps only lines with that text.
From a script:
Script errors
A script error is logged with its file and line:
Double-click the line in the console to open that script in your code editor.
An error in OnUpdate or OnFixedUpdate switches that script off on that entity until the scene restarts, so it is logged once and not sixty times a second. Fix the file and save it: in play mode the script is reloaded and gets another chance.
Common ones:
Seeing what a script is doing
Draw it. Debug lines show in the viewport while the game plays:
Each lasts one frame, so call it from OnUpdate.
Seeing physics
Turn on Colliders in the viewport toolbar. Every collider, character and joint is outlined: green is static, orange dynamic, blue kinematic, yellow a trigger, cyan a character and magenta a joint.
If something falls through the floor, look here first. The usual reasons are a missing collider, or two layers set to pass through each other in Project Settings.
Pausing and stepping
In play mode, Pause freezes the game and Step runs one frame. Turn off Game camera to fly around the paused game and select things. The inspector shows their values as they are right now.
Looking inside a running game
With the editor started with --server, the lua.run command runs any Lua in the running game:
Log files
Crashes
If the engine itself crashes, the reason and a stack trace are written to the console and to the end of the log file. Read the end of the log first.
A crash is a bug in the engine, not in your script: a script error can never crash it. Please report it with that part of the log.
Slow frames
Press F3 for the Performance window, which shows where each frame's time goes on the CPU and on the GPU.
Validation
Start the editor or the runtime with --validation to turn on Vulkan's own checks. It is slower, and reports rendering mistakes as errors in the log.