Lib.QuickReload 1.1.2

Additional Details

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                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Lib.QuickReload" Version="1.1.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Lib.QuickReload --version 1.1.2                
#r "nuget: Lib.QuickReload, 1.1.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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

Nuget package version Nuget package downloads

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

  1. Open your Rimworld mod C# project in Visual Studio.
  2. Right-click on your project, select Manage NuGet Packages...
  3. Search for package Lib.QuickReload by Epicguru and install it.
  4. 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 Compatible and additional computed target framework versions.
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .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.

Version Downloads Last updated
1.1.2 753 9/25/2021 1.1.2 is deprecated because it is no longer maintained.
1.1.1 321 9/24/2021
1.1.0 327 9/24/2021
1.0.0 347 6/29/2021
0.1.0 347 9/24/2021

Tweaks to public API, not user facing changes.