How to create custom editor warnings in a tool script

Godot Version

4.2.stable

Question

I would like to report my own node configuration warnings, but following documentation exactly and making a simple prototype, I have never gotten it to work. What am I missing?

My scene is a single Node2D with this attached script. When the set_me variable is changed in the editor, the configuration should go off accordingly. Even just returning a warning with no conditionals in _get_configuration_warning() does not work.

@tool
extends Node2D

@export var set_me := 0:
	set(value):
		set_me = value
		if Engine.is_editor_hint():
			update_configuration_warnings()

func _get_configuration_warning():
	if set_me > 0:
		return ["Set me must be less than zero!"]
	return []

It seems you miss-spelled your function name.
its _get_configuration_warnings with an “s” at the end.

If that doesn’t work, remember that you need to reload your scene to make the script icon turn blue and enable tool scripts when you create them for the first time.

1 Like

That fixed it! Wow I’ve tried to get this several times over the last month and didn’t notice ><

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.