Chapter 8
233
How to do it...
- Start by creating a new class which will be our actual debug menu. Have
it extend from CheatManager. You'll notice that we have this class within
PlayerController. This allows our cheat manager (really, our debug menu)
to capture all of our input commands. It is also a collection of executable functions
capable of performing numerous commands.
class DebugMenu extends CheatManager within
PlayerController; - We also want to keep these organized, so we'll use a struct record type to
do just that.
struct DebugCommand
{
var string CommandName;
var string Command;
};
struct SDebugCommandPage
{
var string PageName;
var array<DebugCommand> PageCommands;
};
- We're going to create a number of commands, so let's add the variables for
them as shown in the following code snippet:
var arrayCommandDebugPages;
var int CurrentPage;
var int CurrentIndex;
var bool bShowDebugMenu;
Be sure to add the structs above your variables! Otherwise, the compiler
won't recognize the variables inside as they haven't been created yet.
- We need a way to turn our debug menu on and off now, so let's add the following
code snippet:
/*****- Toggles Debug Menu on and off
*****/
exec function ToggleDebug()
- Toggles Debug Menu on and off