You might have noticed while playing around in Godot, that several built-in nodes will display a node configuration warning if they're not properly setup. Either through an invalid combination of node settings, or because they require themselves to be in a specific layout within the scene, they'll display the configuration warning to alert you to an issue.
Now let's say you've developed your own custom node that has one of these limitations, and you want to alert the developer to an issue, just like a built-in node. Godot fortunately makes this extremely easy.
func _get_configuration_warning() -> String:
return "A custom node configuration warning!"
_get_configuration_warning() -> String is a virtual function found in
Node, that upon being implemented within a class, alerts the editor that it should display the node configuration warning.
Returning an empty string will notify the editor that there's currently no warning to display.
The string returned by the function is the message that'll be displayed within the warning when hovering the mouse over it. Returning an empty string will notify the editor that there's currently no warning to display, and the warning will be hidden from the node in the scene tree.
The final part is the
tool declaration at the top of the script. Without it, the editor will be unable to execute the code within the function, and thus cannot determine the correct warning message to display or if it should be displayed at all. So omitting it causes the editor to permanently display the warning icon (with no attached message).