Debugging


Game Framework provides some tools, scripts and components to help you debug and trace what is going on in your games.

MyDebug – Logging and Debug Functions.

Unity offers its own Debug class for logging of information and other features. MyDebug is a wrapper around this class that provides extended logging and drawing functionality along with some other some useful extensions.

MyDebug will only output in editor mode, and also provides the property DebugLevel that controls how much information is output to the main Console. You can either set DebugLevel through code, or if you have a GameManager component added to your scene then you can set this under the Advanced section.

You can mix MyDebug and Debug calls as needed and depending on whether you need information runtime.

Other Components

Within the Debugging namespace there are a number of components to assist you with debugging your game.

LogToDisk and LogToScreen allow you to either save out or view logging information. Both have options so that you can specify whether this should only be done only in debug builds. You can also enable the components conditionally through scripting if you want to have this only active periodically.

LogToScreen

DummyGameLoop is a simple implementation of a game loop that works with the GameStructure components. It provides buttons that allow you to trigger win and lost conditions for quickly setting up and evaluating your game structure without actually writing the game portion. It is used for this purpose in the Getting Started Tutorials.

Cheat Functions Window

The cheat functions window is accessible from the menu Window | Game Framework and gives you a lot of options for testing and simulating functionality before you spend time implementing and setting up things. There is support for working with preferences, in app purchase simulation, players, worlds, levels, free prize and more.

Billing Cheat Window

Other

There is also support in other areas of the framework to help you quickly get up and running, and understanding what is happening in your game. One notable item is the Message Log Window (Menu | Windows | Game Framework) that displays a list of the various messages that are triggered and sent. This window gives you an idea of what is happening in the background and how you can hook into various events to better structure your game.

MessageLog

See the section on Messaging for further information.

See also

If you have any thoughts or suggestions on improvements or additions to the debugging features then please let us know!