How to track changes in an exported variable?

Godot Version

Godot 3.5.3

Question

I have an exported enum variable for changing armor/clothing, how can I make it so that when I change this variable in the editor, I could get some kind of signal about this and change the armor on the character automatically in the editor

You need to do two things.

Firstly, the script for your armour/clothing needs to be a tool. This is because you need to tell the editor to run the script while it’s running.

Secondly, you need to have a setter declared for your exported variable, so you can create a function that will run when the value changes.

3 Likes