0 votes


in unity, there is a validate() method called everytime i property is changed in inspector

is there something like this for godot ?

i have a tool script that need to update things when the transform (position or rotation or scale) of a node2d is changed (and i would like in general to catch any change in inspector to update my scene for a tool script !)

i dont see any notification event happening when i change some variables

i cant find signals for this

i cant make setget method (or can i?) because its about catching any change in the transform of a node2d

Thanks for help

Godot version 3.3.3
in Engine by (25 points)

I haven't found any signals for your use, but this might help: https://godotengine.org/qa/92739/check-if-variable-is-changed

2 Answers

–1 vote


Object class    
void property_list_changed_notify()

Notify the editor that the property list has changed, so that editor plugins can take the new values into account. Does nothing on export builds.
by (153 points)

This function is used to send a notification to the editor manually (for updating the property inspector), not a virtual function that is called automatically when any property has changed. The latter is what OP need, but it does not exist.

+1 vote

method1: Built-in node types have predefined setter and getters. Override the predefined setter, for example set_position(value) in Node2D. It will be called when even you set position in the editor, as long as you use tool keyword.

method2: Use notification. All CanvasItem has NOTIFICATIONTRANSFORMCHANGED, capture it in _notification(what) and do things. This notification will be sent whenever and however the transform is changed (even when the transform was changed by Tween or AnimationPlayer). But you have to use tool keyword to receive it in editor.

by (330 points)
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.