_GetConfigurationWarnings() equivalent for Resources?

Godot Version

4.3.0

Question

I’m using Godot 4.3.0 with C# and looking at using custom resources in a project. In the past I just used nodes for everything, and would generally validate their configuration inside _Ready() throwing an exception is anything was wrong or missing. Since then I’ve discovered _GetConfigurationWarnings() and Tool scripts which is feeling nicer. Looking at extending Resource though neither option seems available, so how can I enforce/warn when invariants are broken?

I could always add my own _GetConfigurationWarnings() to the resource, and then have nodes aggregate the warnings of any used resources… but that’s just kinda messy, and it feels like there should be a better option provided.

You can use @tool in Resources but, unlike Nodes, they don’t have a warning mechanism.

By using @tool you can enforce what’s get exported and how by using Object._validate_property() or Object._get_property_list(). Here’s an example that change the options of a dropdown depending on the value of another dropdown.

Or use print() or its variants printerr() or print_rich() to print the warning/error to the Output dock when something is not valid.

This is also another option.

1 Like