+1 vote

I have a script defining a custom node. It's a tool script, and it overrides _get_configuration_warning(). One of situations I want it to warn about is certain invalid combinations of values for exported variables. Unfortunately, when I change those values in the inspector to the invalid combo, the warning doesn't appear unless I either save the script (even when nothing changed in it), or I add/remove some child nodes.

I see that Node has a method called update_configuration_warning() in the C++ source, but it doesn't seem to be exposed to gdscript.

Is there some other way to force the editor to check _get_configuration_warning() from code? Or maybe I'm approaching this problem the wrong way?

in Engine by (65 points)
edited by

2 Answers

+5 votes
+1 vote

Found a workaround, not sure if it might have some unwanted side effects but it seems to work. I wrote custom setters for the exported variables, each of which end with the following:

if is_inside_tree():
    get_tree().emit_signal("node_configuration_warning_changed", self)

(without the isinsidetree() check, it crashes when loading the scene)

by (65 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.