Nez is a framework which adds additional functionality on top of MonoGame and FNA. Gum can be used with Nez since Nez ultimately exposes the MonoGame/FNA GraphicsDevice. Aside from setup, using Gum in Nez is identical to using Gum in any MonoGame project. Therefore, after setup you can reference the MonoGame section for usage details.
Nez projects use a game class which must inherit from Nez Core. This class ultimately inherits from the standard MonoGame Game class, so you can include overrides for Update and Draw just like any standard MonoGame project.
A typical game may look like is shown in the following code snippet:
If you have been able to get Gum working in a Nez project without any runtime errors, you are ready to start adding more complex UI to your game. Head on over to the MonoGame section for more information.
Could not load file or assembly 'MonoGame.Framework, Version=3.8.1.303
If you add the Gum code to your project, you may experience this exception internally from Nez:
The reason this is happening is because currently (as of July 2024) Nez links MonoGame 3.8.0 instead of 3.8.1 (the latest).
To solve this problem, your project must explicitly link MonoGame 3.8.1 or else you will have this exception.
To do this:
Open your project in Visual Studio
Expand the Dependencies item
Right-click on Packages and select Manage NuGet Packages
Click on the Browse tab
Search for MonoGame.Framework
Select the MonoGame.Framework NuGet package for your particular project type. This is most likely MonoGame.Framework.DesktopGL, but it may be different if you are targeting another platform.
Click the Install button to add the NuGet package
After adding MonoGame, your NuGet packages should similar to the following image: