Skip to content

Hot reload

  1. Open the Beacon tutorial project and stop play. In the Content Browser, double-click Beacon under Python Classes.
  2. In begin_play, change ue.log(self.message) to ue.log(f"Starting up: {self.message}") and save.
  3. Return to Unreal and press Play again. In Output Log, search for Beacon is ready. The latest line begins with Starting up: and still uses the message you set in Details.
Compare the Output Log before and after hot reload (GIF)

The Output Log shows Beacon is ready before the edit, then Starting up: Beacon is ready after the next Play.

Auto Reload Scripts is enabled by default in UnrealPy project settings.

What happens to a redefined class:

  • It gets a new Unreal version.
  • In the editor, live instances and Blueprint subclasses move to it, keeping their Unreal properties and their Python state (self.__dict__). post_init is not run again, so initialise new Python state defensively.
  • Outside the editor, existing instances keep the version they were created with.

Safe by default

All new versions are checked first. If one is broken (a syntax error, a rejected definition), the reload raises before anything changes and every module keeps its previous version. Modules that derive from or embed the changed types (a subclass, a struct used as a field) are reloaded together, in dependency order.

Reload from code

import ue

ue.reload("mygame.items")        # returns the list of reloaded modules

__main__ and modules without a source file cannot be reloaded.

Limits

  • Persistent types only accept additive changes. Adding struct fields or enum entries works; removing, renaming or retyping a field is rejected (Structs and enums).
  • A script bound to a Blueprint is rebound to the new class on reload.