Lib.QuickReload
1.1.2
No longer maintained or supported. See https://github.com/Zetrith/HotSwap for a good alternative.
dotnet add package Lib.QuickReload --version 1.1.2
NuGet\Install-Package Lib.QuickReload -Version 1.1.2
<PackageReference Include="Lib.QuickReload" Version="1.1.2" />
paket add Lib.QuickReload --version 1.1.2
#r "nuget: Lib.QuickReload, 1.1.2"
// Install Lib.QuickReload as a Cake Addin #addin nuget:?package=Lib.QuickReload&version=1.1.2 // Install Lib.QuickReload as a Cake Tool #tool nuget:?package=Lib.QuickReload&version=1.1.2
Rimworld C# Hot Reloader
Lib.QuickReload
By simply adding an attribute to your rimworld C# class, your code is automatically hot-reloaded, meaning that you don't have to close to the game to apply changes. This will save countless hours of waiting over the course of mod development, especially for code that requires many small tweaks such as UI.
Installation
- Open your Rimworld mod C# project in Visual Studio.
- Right-click on your project, select
Manage NuGet Packages...
- Search for package
Lib.QuickReload
by Epicguru and install it. - Rebuild to make sure that it is installed correctly.
Usage
For the mod assembly(s) to be reloaded, you must add the [ReloadAPI.Reloadable]
attribute to any class in your mod.
I recommend putting it on your main Mod
class, but it doesn't really matter where it is.
For example:
using Verse;
using ReloaderAPI;
[Reloadable(ReloadBehaviour.All)]
public class Core : Mod
{
// ... mod code here.
}
There are four possible options for the ReloadBehaviour
.
There is a slight performance difference between them, but generally All
is the best option.
ReloadBehaviour.All
: Every single method in the assembly can be hot-reloaded. This is the default value.ReloadBehaviour.None
: Disables hot reloading.ReloadBehaviour.OnlyWithAttribute
: Only methods that have the[Reloadable]
attribute can be hot-reloaded.ReloadBehaviour.OnlyWithAttribute
: Only methods that do not have the[Reloadable]
attribute can be hot-reloaded.
To hot-reload, simply re-build your code.
The keyboard shortcut to rebuild is Ctrl+Shift+B
. If you have a good project configuration, this should automatically output .dll files to your mod's Assemblies folder.
You should immediately see your changes reflected in Rimworld, and a confirmation message.
If the game crashes, your probably edited something that isn't allowed (see limitations below).
Limitations
- You cannot change method signitures.
- You cannot create new types, methods etc.
Credits
Based closely on the Unity hot reload code written by Zapu.
Uses Mono.Cecil behind the scenes, which I obviously didn't make.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
-
.NETFramework 4.7.2
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Tweaks to public API, not user facing changes.