Quick answer: Call NotifyPropertyListChanged() after modifying conditional properties so the inspector re-queries.
Toggle a "isEnemy" bool. Custom inspector should show enemy-specific fields. Inspector stays static. Property list cached.
The Fix
[Tool]
public partial class Entity : Node {
private bool _isEnemy;
[Export] public bool IsEnemy {
get => _isEnemy;
set { _isEnemy = value; NotifyPropertyListChanged(); }
}
public override Godot.Collections.Array<Godot.Collections.Dictionary> _GetPropertyList() {
var list = new Godot.Collections.Array<Godot.Collections.Dictionary>();
if (IsEnemy) list.Add(new Godot.Collections.Dictionary {
{ "name", "Aggro Range" },
{ "type", (int)Variant.Type.Float }
});
return list;
}
}
Notify on toggle re-runs _GetPropertyList. Conditional fields appear/disappear cleanly.
Verifying
Toggle IsEnemy in inspector. Aggro Range field appears. Toggle off: hidden.
“Notify after change. Inspector refreshes.”
Related Issues
For C# Export Flags, see flags. For C# Collections.Array, see Collections.Array.
Notify list. Inspector reads.