public sealed class HotReloadHostThe live components of one document, and the three ways an edit reaches them.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Styles reload without rebuilding anything: the rule set is replaced and the cascade runs again, so every element keeps its identity and therefore its focus, its scroll offset and its animation state. This is the channel that is genuinely free, and it is the one a designer uses all day.
Markup reloads by re-running Build on the same component objects. Their fields survive because the objects do — which is most of what state preservation means — and their elements do not, because two Build bodies are two different programs with no shared identity beyond position. The focus is put back by path.
A component can also be replaced outright, for the edits .NET calls rude. Then the new instance starts empty and HotReloadStateAttribute says what to carry.
⚠ What this does not do is deliver the new code. A changed .vxml becomes a different Build only after something has recompiled it, which is dotnet watch's job and the source generator's; until that generator exists, the markup channel reloads whatever Build is currently in the assembly. That is not a limitation of the reload — it is where the boundary between this and the build is.
Fields and properties (2)
public UiDocument DocumentThe document.
public IReadOnlyList<Component> ComponentsThe components being watched, in mount order.
Events (1)
public Action<ReloadReport>? ReloadedRaised after every reload, successful or not.
Methods (5)
public HotReloadHost(UiDocument document)Creates a host over a document.
public T Mount<T>(UiElement parent) where T : Component, new()Builds a component and keeps track of it.
public ReloadReport ReloadStyles(int sheet, string css)Replaces a stylesheet.
public ReloadReport ReloadComponents()Re-runs Build for every tracked component.
public ReloadReport Replace(Component component, Func<Component> create)Replaces a component with a fresh instance, carrying its marked state over.
Used by (7)
- HotReloadTestsVixen.Ui.HotReload.Tests
- HotReloadWatcherVixen.Ui.HotReload
- MetadataUpdateVixen.Ui.HotReload
- BrushInspectorMarkupTestsVixen.Editor.Terrain.Tests
- EditorApplicationVixen.Editor.App
- MarkupInspectorVixen.Editor.Inspector
- TerrainModuleVixen.Editor.Terrain