Debugging - Gorzontrok/Bro-Maker GitHub Wiki
There are a few different tools you can use to debug your bros.
BroMaker Log
You can write to the BroMaker log like so:
BroMakerLib.Loggers.BMLogger.Log( "Hello World!" );
You can shorten this by adding a using statement at the top of your class:
using BroMakerLib.Loggers;
// Rest of your code
BMLogger.Log( "Hello World!" );
Runtime Unity Editor
This tool is incredibly powerful for understanding what's happening in the game without having to use tons of debug logging. You can download it here, you'll want the UMM version, and you can install it the same way you install any other Broforce Mod.
Once you have it installed, you can open it in game by pressing F12 by default. I'd recommend changing this to F11, since F12 is the default screenshot button for Steam. You can change it via its options menu in the in-game Unity Mod Manager window.
When you open it, you should see something like this:
Most of these windows you can just close out of, but you'll definitely want to keep the object browser on the right open.
Object Browser
With the object browser, you can view all the GameObject in the scene, and their components. The way I usually use this tool, is by middle-clicking on an object in-game, like my bro for example, which will show this (if you don't see this, you might need to middle-click multiple times to cycle through the objects your mouse cursor is over):
The items in this list (Transform, MeshFilter, MeshRenderer, SpriteSM, Rambro, etc) are all the components that are attached to your bro's GameObject. The main one relevant to us is Rambro, which is the main component that controls all the logic for your bro. For custom bros, this will be whatever you named your bro's class.
Inspector
If we click on this Rambro component, we can pull up the component in the inspector:
From here you can look through all the variables / functions your bro has, and actively change them or call them.
So let's say I want to try adjusting my bro's fire rate, but I don't want to have to close and reopen the game every time I make a change. I can simply filter for it at the top, or scroll through until I find it, and then set my own value:
Time Control
The other way I frequently use this tool is for controlling the game speed. You can do this via the controls on the bottom bar:
The > and || buttons are for resuming and pausing the game. The 1.00, controls the game speed, so if you have it set to 0.5, the game will run at half speed, or if it's set to 2.00, it will run at double speed.
These options are useful for debugging quick moving objects, such as any of the projectiles in the game, or for slowing down the playback of an animation to get a better idea of how it looks and make sure all the frames are playing.
The pause is also very useful for when you want to examine an object in the inspector.