Quick answer: Hot reload reconstructs the C# object — plain fields reset. Store editor state in [Export] properties (serialized) and rebuild caches in _Ready.
A custom [Tool] node builds a procedural mesh in the editor. After every C# rebuild, the configured parameters vanish — hot reload didn’t preserve the plain fields.
Plain Fields Don't Survive
On rebuild, Godot reconstructs the managed object. Only data Godot knows how to serialize — exported properties — is restored. Plain C# fields revert to defaults.
Use Exported Properties for State
[Tool]
public partial class ProcMesh : Node3D
{
[Export] public int Segments { get; set; } = 8;
[Export] public float Radius { get; set; } = 1.0f;
// transient — OK to lose, rebuilt below
private Mesh _cachedMesh;
}
Anything the user configures must be [Export]. Transient caches can be plain fields — just rebuild them.
Rebuild Caches in _Ready / _EnterTree
public override void _Ready()
{
if (Engine.IsEditorHint())
RebuildMesh(); // regenerate from exported params
}
_Ready runs after a hot reload reconstructs the node. Regenerate transient data from the (preserved) exported properties.
NotifyPropertyListChanged
If your tool changes the property list dynamically, call NotifyPropertyListChanged() after a reload so the Inspector refreshes.
Verifying
Configure the tool node, edit the C# script, rebuild. Exported parameters survive; the mesh regenerates from them. No lost configuration.
“Hot reload only keeps what Godot serializes. Exported properties survive; plain fields don’t.”
Treat _Ready in a tool script as ‘reconstruct everything transient’ — it runs both on scene open and after every reload.