Navigation
Browse the developer docs

FH2 Mod Platform for .NET

FAQ

Common questions about writing .NET mods.

By Bartholomew Ho (qiangqiang101) · MIT license · v0.12.0 · 15 Nov 2026 · repository · original page

On this page

Why OnInit and not Sub New?

The SDK makes your class first, and only then registers it with the platform under the name in Info. Until that's done, your mod has no name, no log and no settings, so in Sub New (a constructor) Log, AddSetting and the like have nothing to attach to.

OnInit runs right after registration, when all of that works. Hosted mods also get a fresh copy for each reload, and OnInit runs on each one with IsReload telling you which it is.

Keep the constructor empty, or don't write one.

Do I need to know reverse engineering?

No. The FH2 classes do the hooks and memory for you. GameCode, HookFunction and PatchBytes are there for when you want to go further.

C# or VB.NET?

Whichever you know. Both build hosted and NativeAOT mods, and use the same classes. VB can't write some low-level things (pointers, function pointers), so its hooks take delegates instead. See Your first mod in VB.

Can I use NuGet packages?

Yes, in a project. Hosted mods get any package. NativeAOT mods get packages that work with NativeAOT. Scripts can't use packages.

Does it work online?

Set OfflineOnly = true in your ModInfo and the mod is held back while you play online. Platform.NET does this per hosted mod, so other hosted mods keep running.

Do my players need .NET?

For a NativeAOT build, no: just the platform. For a hosted mod or a script, they need the .NET 10 runtime (x64) and Platform.NET. See Hosted or NativeAOT?.

Can I convert a C++ platform mod?

Yes. Everything in fh2mod.h is on Mod and ModPlatform, one method per function, so the platform's own docs apply as written. Most of a mod's hooks and memory reads can usually be replaced by the FH2 classes.

Where do I report bugs?

Issues, with your platform.log and what you were doing.

Copied from the wiki page FAQ at commit 7396a07 · MIT license
MIT License

Copyright (c) 2026 Bartholomew Ho

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.