 I'm working on a game called Star Dog, not too dissimilar to Star Fox, where you pilot and control a ship moving forward constantly in space. Working on this is quite difficult because when I reach the end of the level I have to go and escape and restart the whole scene, or if I want to modify player movement and the player is always moving forward it's a bit difficult to manage that. The Dough has a concept of debug mode, which you can see in the title bar of your running game that we're in debug mode. When you run your game from the editor it's in debug mode, but when you export it for your players to play it's in release, it's a release build, so you can write code that checks if it's debug mode and add functionality that will assist you during the game development process to make it easier, faster, and generally improve the experience of making your game. So let's go ahead and add two debug things to this Star Dog game. We'll add one that pauses the player movement so that we can easily modify the tilting of the player model, and we'll add one that has us reset the scene quickly using the keyboard key. And then at the end I'll show you some other ideas that debug mode's good for. So we'll first start out by going to Project Settings, we'll go to Input Map and we'll add a new action, we'll call it Debug Reset Scene. I prefixed them with Debug so that I know it's intended to only be used in Debug mode. And I'm going to press the R key. So now Debug Reset Scene is R. If you were testing it with your controller you could also add a controller key or a controller button to reset to, but we'll close it for now. And then Star Dog is its own scene here so you can see we've got the ship and we've got the level laid out and there's a script attached to it. We'll go ahead and we'll do Funk, Input, to check for every input event. And we'll say if OS.isDebugBuild, OS.isDebugBuild is the main way to check if we're in Debug mode. So you just say if it's Debug mode and you can do double ampersand or you can do this. I use the double ampersand out of habit from other languages. So we'll say if it's Debug mode and event.input or is action pressed and then you just type Debug, reset scene, add it colon and then we'll say getTree.reloadCurrentScene and we can call deferred on it. So that'll run it at the end of the current loop instead of right away to let anything running finish processing. So now we save that. If we just go ahead and run our current scene, StarDog launches, we're moving forward. If I press R, it resets the scene. This is really useful for certain types of games or maybe certain stages of your development. You can make resetting do all types of things. For me, this just resets the scene to the start and that's pretty helpful. So you can go ahead and test things out. So os.isDebugBuild and you check for things as normal. Now for our player constantly moving forward, once there's no more asteroids to look at, it's kind of difficult to tell the player space in 3D because there's no reference points. So let's go ahead and make it so that we can pause our player movement with a hotkey. So we'll go ahead and we'll add one called, I'm going to prefix it with StarDog because this is a collection of different projects. We'll call it StarDog.DebugPausePlayerZ. So that's movement on the Z axis. We'll add it and I'm going to make the one number pressing that pause that. So then in our player here we have forward speed and there's a physics process. The main line we care about is here velocity.Z is equal to forward speed. So we'll do a couple things. We'll add a var called var forwardPause is false and then we'll say if forwardPause velocity.Z is equal to zero, else we'll set the velocity Z to the forward speed and velocity pause defaults to false because we want the game to start with the player moving and then just like in our other code we'll do in the input callback we'll say if OS.isDebugBuild and input.isActionJustPress we'll say StarDog.DebugPlayerZ. So if the debug player Z.isPress we'll just toggle forward, we'll toggle forwardPause. So we'll say forwardPause is equal to the negated forwardPause. Go ahead and save that. Now if we run the game again and I press one our player isn't moving but I can still move along the X and Y axis which that would be really helpful for refining player movement in those directions without having to worry about the player moving forward. If we go ahead and export the game and run a non-debug build we'll go here, we'll go to macOS and we'll say export project and we'll just call it game.macOS that's fine. Now we're going to uncheck export with debug because we don't want to export it in debug mode. I think if you clicked that and distributed a build then it would have the debug settings and that might be useful for maybe if you had testers or friends playing it and you wanted to have functionality to make it easier to run. Now if we go ahead and run the program and we click into StarDog if I press R it doesn't reset. If I press one it doesn't pause the player's movement. So that is the power of debug mode. You can conditionally code for aspects of game development that will make your life easier but not be present to the players in the end. Now let me give you another example of this in a different game just so you have a sense of what it is. So I made this bullet heck game, it's a little prototype. Now if I press zero it toggles a UI that tells me some hotkeys for debug mode because it's easy to forget them. But that's only visible in debug mode and zero toggles that. Now if I press one that toggles invincibility because sometimes when you're playing a game it can be you want to test out the boss or something like that let's say and you don't want to worry about dying you just want to play the game. So you can press one to toggle it now I'm not invincible so if I get hit I take damage but if I don't, if I toggle it on and I get hit then I don't. So that's just one example you could toggle invincibility you could render hitboxes you could do all sorts of things. The options feel pretty limitless when you start doing it and because you're just coding in your game normally you can make it change the color of objects to represent that you can display some text to make it clear it's debug mode. This could also be useful for recording clips for like a trailer or video or something where you want to capture the essence of the gameplay but not worry about dying. So yeah lots of options for debug mode just to review it one more time you just do os.is debug build to check it you can add input actions for it and code your game accordingly. It's been so helpful for me and hope it's helpful for you all right see you.