This page assumes you have an existing MonoGame project. This can be an empty project or an existing game.
At the time of this writing Gum + MonoGame has been tested on a variety of platforms including DesktopGL, DirectX, and mobile. It has also been used with Nez and Kni. If your particular platform is not supported please contact us on Discord and we will do our best to add support.
Open your MonoGame project in your preferred IDE.
Add the Gum.MonoGame
NuGet package
Open your Game class (usually Game1.cs)
Add the following code to your Initialize method:
SystemManagers.Default = new SystemManagers(); SystemManagers.Default.Initialize(_graphics.GraphicsDevice, fullInstantiation: true);
Add the following to your Update method:
SystemManagers.Default.Activity(gameTime.TotalGameTime.TotalSeconds);
Add the following to your Draw method after you clear the graphics device:
SystemManagers.Default.Draw();
To test that you have successfully added Gum to the project, add the following code to your Initialize method after SystemManagers.Default.Initialize:
If everything is initialized correctly, you should see a white rectangle at the top-left of the screen.
This page shows the minimum code needed to get Gum up and running in your project. If you want to load a Gum project created in the Gum tool, see the Loading a Gum Project page.
The Gum tool can be used to create Gum projects which can be loaded into your MonoGame project. To download and run the Gum tool, see the Setup page.
The easiest way to use Gum is to add the NuGet packages to your game project. Alternatively you can link your game to Gum source for additional debugging, to stay up to date with the latest improvements, or if you are interested in contributing.
This document assumes you already have a game project with the Gum NuGet packages linked.
If you have followed the Setup steps, then you should have a game which references the Gum NuGet package.
To replace this package with source references:
Clone the Gum repository
Remove the NuGet package by selecting Gum.MonoGame and pressing the Delete key.
Right-click on your Solution in the Solution Explorer and select Add -> Existing Project...
Select <Gum Root>/MonoGameGum/MonoGameGum.csproj
Repeat the previous step but select the following csproj files:
<Gum Root>/GumCommon/GumCommon.csproj
<Gum Root>/GumDataTypes/GumDataTypesNet6.csproj
<Gum Root>/ToolsUtilities/ToolsUtilitiesStandard.csproj
Right-click on your game project's Dependencies folder and select Add Project Reference...
Check the Gum projects you added to the solution earlier and click OK
You are now fully linked to source. You can build and run your game.