Getting Started

Getting Started

Open Hot Reload

Once Hot Reload is set up and enabled as outlined in the previous instructions, you can access it directly within Unity.

There are two ways to open Hot Reload:

  1. Open the Hot Reload window by navigating to "Window" in the Unity menu bar, then selecting "Hot Reload".
  2. Use the shortcut key combination Alt+Shift+H to quickly open the Hot Reload window.

Once Hot Reload is open, you will see a button in the bottom right corner of the window with a text saying "Show on Startup". This option allows you to choose whether Hot Reload should automatically open when Unity starts up.

Downloading Additional Content

By default, Hot Reload ships as an extremely lightweight extension. However, in order for Hot Reload to function, it needs to download the Hot Reload server binary for the specific platform and Unity version it is running on. When Hot Reload first starts, it will seamlessly download this server binary and then start Hot Reload. Hot Reload will only download this server binary on startup each time the package is updated to a newer version.

Hot Reload downloads this server binary after install rather than packaging it initially due to the size of the binary. Since the package is compatible with Windows, Linux, and Mac (Intel and Silicon), we need to use a different binary depending on your operating system. Rather than packaging them all in the initial asset and making the total asset size massive, we download only the specific binary needed for your operating system the first time you install. This helps to reduce bandwidth, which gets you started using Hot Reload sooner than if every operating system's binary was included in the initial package.

The Hot Reload server binary contains all the code necessary to Hot Reload code - dotnet, our C# compiler, and our own code used to Hot Reload changes. Without this, users would need to install the exact version of dotnet to compile the code, which is a massive logistical headache and creates a very tricky to install system.

The server binary is downloaded to the following location: %LocalAppData%/singularitygroup-hotreload/.

How does it work?

Hot Reload is a C# compiler extension which only compiles the specific method that changed (which is very fast, taking only milliseconds). After compiling, we swap only that function with the new version.

This also means that there's no domain reload involved, so your static variables stay intact.

Unity Auto Refresh

When Hot Reload is active, it automatically disables the "Auto Refresh" setting, which typically triggers domain reload whenever code changes are detected. By temporarily disabling this setting during Hot Reload, developers can immediately see the effects of their code modifications without interruption caused by domain reload.

Moreover, when the Hot Reload server shuts down, the previous "Auto Refresh" setting gets restored. This automated management of the "Auto Refresh" setting guarantees a seamless transition between Hot Reload sessions, enhancing productivity and reducing unnecessary disruptions.

In cases where users prefer to have manual control over the "Auto Refresh" setting, our software provides an option to disable this automatic management. By adjusting the settings, developers can retain their preferred "Auto Refresh" behavior, regardless of the Hot Reload status. This customization option allows for greater flexibility in adapting the development environment to individual preferences and workflows.

You can manually trigger a recompile with CTRL+R, and the editor will determine automatically what needs to be compiled. This manual recompile should be used when making unsupported edits, such as adding a new class. A clear warning will be displayed when you make an unsupported edit.

Do note that after making an unsupported edit, it is often still possible to continue editing unrelated files and functions. The unsupported edit simply will not be visible in the editor until a manual recompile is performed.

đź’ˇ

JetBrains Rider's "Automatically Refresh Assets in Unity" will similarly interfere with Hot Reload. Therefore, we recommend you disable this setting.

Hello

Upgrading Hot Reload

When a new version becomes available, the upgrade button will appear at the bottom of the Hot Reload window, which you can use to download and install the latest version.

You can upgrade Hot Reload via the package manager, but we don't recommend it as it can lead to compilation errors. To use the package manager safely, uninstall the package before installing it again with the new version.

Uninstalling Hot Reload

Here is what you need to do if you want to completely remove Hot Reload from your project:

  • Stop Hot Reload
  • Remove Hot Reload with the Package Manager
  • Remove Local App Data. Make sure the following folders are removed from your PC:
    • remove folder at %LocalAppData%\singularitygroup-hotreload
    • remove folder at %LocalAppData%\LicenseSpring\codepatchertrial if it exists
    • remove folder at %LocalAppData%\LicenseSpring\codepatcher if it exists
  • Remove project specific data folder at <Path-to-unity-project>\Library\com.singularitygroup.hotreload

After you've removed this data, you might want to update your Unity "Auto Refresh" and "Script Changes While Playing" Preferences. See Unity documentation (opens in a new tab) for your specific Unity version.

If you experience issues with your changes not auto refreshing, please consult the troubleshooting section.


Copyright © 2023 Hot Reload for Unity