Merge pull request #75591 from KoBeWi/how_to_spam_people_with_warnings_correctly

Add `_get_configuration_warnings()` example
This commit is contained in:
Rémi Verschelde 2023-04-02 17:35:03 +02:00
commit df7834ac96
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 12 additions and 0 deletions

View File

@ -42,6 +42,18 @@
The elements in the array returned from this method are displayed as warnings in the Scene dock if the script that overrides it is a [code]tool[/code] script. The elements in the array returned from this method are displayed as warnings in the Scene dock if the script that overrides it is a [code]tool[/code] script.
Returning an empty array produces no warnings. Returning an empty array produces no warnings.
Call [method update_configuration_warnings] when the warnings need to be updated for this node. Call [method update_configuration_warnings] when the warnings need to be updated for this node.
[codeblock]
@export var energy = 0:
set(value):
energy = value
update_configuration_warnings()
func _get_configuration_warnings():
if energy < 0:
return ["Energy must be 0 or greater."]
else:
return []
[/codeblock]
</description> </description>
</method> </method>
<method name="_input" qualifiers="virtual"> <method name="_input" qualifiers="virtual">