Skip to content

Class HotReloader

Namespace: Apogee.Scripting
Assembly: Apogee.Scripting.dll

Reloads what changed on disk while the game runs (a development run, the editor). , called from the thread that owns the VM, takes the changes a has noticed and sorts them: a .luau file that a script has required is a module reload (: updated in place, the old one stays if the new one fails); a definition or schema in a package's content or schema folders makes the definitions be read again ( is replaced and defs.on_change listeners are called); an image or model is imported again (when the project has been imported: imported/index.xml) and says which; a .slang file raises , for the renderer to rebuild what uses it (the engine's renderers do not yet). A change that cannot be applied to a running game (a package's mod.xml, a script that only runs once) is listed in .

public sealed class HotReloader : IDisposable

Inheritance

object ← HotReloader

Implements

IDisposable

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

HotReloader(VirtualFileSystem, LuauVm, PackageSet?, TimeSpan?, IReadOnlyList<IAssetImporter>?)

public HotReloader(VirtualFileSystem files, LuauVm vm, PackageSet? packages = null, TimeSpan? debounce = null, IReadOnlyList<IAssetImporter>? importers = null)

Parameters

files VirtualFileSystem

vm LuauVm

packages PackageSet?

debounce TimeSpan?

importers IReadOnlyList<IAssetImporter>?

What to import again when an asset changes (default: ). The host adds importers of libraries Scripting does not reference, such as shaders.

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Poll()

Reloads what changed since the last call (and has been quiet for the debounce time).

public ReloadReport Poll()

Returns

ReloadReport

AssetsChanged

Raised with the paths of assets that changed (and were imported again, if the project is imported), for the host to load them again.

public event Action<IReadOnlyList<string>>? AssetsChanged

Event Type

Action<IReadOnlyList<string>>?

ShadersChanged

Raised with the paths of shader sources that changed.

public event Action<IReadOnlyList<string>>? ShadersChanged

Event Type

Action<IReadOnlyList<string>>?