The Unload- method is called when our module needs to clean up after itself.
We will fill it with code in the next chapter. The load- method is called when our module is loaded.
Next fill the Property ModuleVersion with a version like "0.1.0". Let's go over the generated code, step-by-step and fill in the "empty spots".įirst fill the Property ModuleName with our module name: The clear names for these functionalities also show us what we need to do and how we need to fill it in. The generated code shows us how we can implement our interface.
You will repeat this chapter every time you wish to create a new Garry's Mod module. We have now created an empty project with which we can start making Gmod.NET modules. VS2022 will say Ready in the bottom left when it's done doing whatever it's doing. It may take a second to download and install. On the right-hand side check the box in front of your project name (GmodHelloWorld).
In the search bar search for "GmodNET.API".In the toolstrip Go to Tools > NuGet Package Manager > Manage NuGet Packages for Solution.Let's add the GmodNET.API NuGet package to our project. This will help us find problems with our code later. Visual Studio will generate a Class Library (.NET Core) project for us. Choose the project name "GmodHelloWorld" (the naming convention is PascalCase/UpperCamelCase).Click Next or double-click the project type.NET desktop development workload and the other required components. Note: Is this project type missing? Double-check that you installed the.Click the project type Class Library (Use the search box to find it faster).If you done everything right, content of your %GARRYS_MOD_ROOT_FOLDER%garrysmod/lua/bin/ should look something like this:.(for example C:\Program Files (x86)\Steam\steamapps\common\GarrysMod\garrysmod\lua\bin).
Install Gmod.NET in Garry's Mod following the instructions in the README.Make sure you are on the Garry's Mod x86-64 Beta branch.Approximately half an hour of your time and patience (including downloading and installing Visual Studio).A copy of Garry's Mod installed through Steam.Ensure at least these individual components are installed:.NET desktop development Workload is installed in Visual Studio We will write our module using a bit of C# (pronounce C-Sharp) code. At the end of this tutorial you will have created and installed your own module that simply states: 'Hello World!' in the console.