How to Debug Your Game in Godot (Breakpoints, debugger, print statements, and more)

preview_player
Показать описание
Debugging your game is an important part of game development. Godot provides an easy-to-use debugger to help you debug. In this video, I'll teach you how to use the debugger, use print statements, and set breakpoints to fix issues and bugs in your Godot game.

00:00 Intro
00:30 Overview of Godot's debugger
01:20 Errors and warnings
03:27 How to use print statements
06:47 How to set breakpoints
10:17 Using breakpoints
16:18 Step Into and Step Over
20:05 Recap
20:56 Fixing our shoot bug
24:15 Outro

🖥 MY GEAR*
WASD V2 87-Key Keyboard

* These are Amazon Affiliate links, so I may earn a commission if you use them to make a purchase. Thanks for supporting the channel!

🎵 MUSIC
"BETTER DAYS" by LAKEY INSPIRED
License for commercial use: Creative Commons Attribution 3.0 Unported "Share Alike" (CC BY-SA 3.0)
Рекомендации по теме
Комментарии
Автор

You should use print-debug() instead of simple print(), it will give you more information in the console, like the lines etc

malandr
Автор

Great, thanks. I thought my breakpoints weren't working due to some bug, but actually I was placing them in function declarations, so thanks to this video I can now use them properly. In fact I was able to find the bug in my game that made it crash; I suspected it was an infinite loop of sorts, and when using breakpoints I found that the program kept cycling over the same 2 lines infinitely. I was originally using print statements, but breakpoints made debugging much faster. Thanks!

alexanderglassgames
Автор

2 years old and still super helpful... thanks so much :D

randomjimbitz
Автор

Very useful! Thanks mate! I use a lot the "print" way to debug since I'm pretty new at coding but I learned recently to use the breakpoints when debuggin in java

juanloutech
Автор

This is super duper awesome helpful, thank you! <3

marci
Автор

Very informative thanks. Also, it is always better to take care of the warnings rather than hiding them under the carpet ^^ They are warnings for a reason

Otochiro
Автор

Just switched to Godot from Unity, so having a way to test a code's functionality with print statements beforehand is so invaluable to have back in my arsenal. Thanks, man.

emissaryofcharybdis
Автор

Been coding for years, always used print statements. This is cool tho, wish I’d taken the time to learn it earlier will try to pick up debugging in other projects outside Godot too thanks!

joeyinfn
Автор

My tip: learn all the buttons in the Debug panel. I spent hours trying to figure out why print() wasn’t working, until i randomly found the button that turns on/off print logs in the panel.

panampace
Автор

My Output is not Giving me print pls fix the porblem

HDMentor
Автор

Thanks for the tips, +1 sub What does --> void do?

timetorelaxfocus
Автор

Hi thanks for the informative vid! I have trouble getting rid of some breakpoints. Just clicking at them again changes their icon or makes them diseappear (what I think should be right), but on the scripts next run it will stop at the same line anyway, with the breakpoint popping up again. Any idea, what I am doing wrong?

Knutmeister
Автор

15:26 why doesnt it show the value when I mouse over "position" or "global_position"?

fdu.
Автор

i think dor theese warnings the best solution is the underscore in front of the value names.

Drachenbauer
Автор

I hope they get their bad documentation sorted out and that there'll eventually be better training available. I like the idea of this game engine, but we've abandoned using it because it was just wasting our time.

loganmedia
Автор

23:40 actually this is wrong, the bullet will still hit the player but it will do nothing, assuming you dont want to have friendly fire the proper way to fix this sort of bug would be to have the player and bullets on different collision layers, otherwise the bullet will still "register collisions" with the player and it could get stuck or something

jlewwis
Автор

A better solution to the unused variable, is to delete it, not ignore the warning.

It's just polluting your code with 2 lines instead of 1 :D

pixelotix
Автор

2 years self taught programming, before game dev I was in web dev and I still use to this day print statement for debugging 🥲

bluespider