Custom Resource not emitting emit_changed on set(value)

Godot Version

4.2.2.stable.official

Question

I’m trying to register changes to a custom Resource, when the values are changed in the editor, but whatever I put in the set(value) function doesn’t seem to execute, whether it’s a print or emit:

class_name MyData
extends Resource

@export var width: int = 1:
    set(value):
        if value != width:
            width = value
            emit_changed()

I have a connection to the “changed” signal from a @tool Node, but it only seems to fire when the Resource script is updated.

Does anyone have any advice on how I can listen to changes to a Resource property value made through the inspector?

Cheers

You probably need to set the Resource script to be a @tool script too.

1 Like

Thanks, I gave that a go but no change unfortunately