Are setters not supposed to trigger on a resource if one of its properties changes?

Godot Version

v4.3.stable.official [77dcf97d8]

Question

Let’s say I have the following resource:

class_name MyResource
extends Resource

var my_string: String

func _init(my_string: String = ""):
	self.my_string = my_string

I also have a node with a MyResource:

extends Control

@export var my_resource: MyResource:
	set(value):
		my_resource = value
		print("resource value set")

If I change the value of my_string of the resource on the node, the setter isn’t triggered. Is this the expected behavior - i.e. that a setter for a resource will only trigger if the resource itself is changed, but not if one of its properties is changed?

Yes this is intended behaviour

OK.

Is the best way to work around this to have a setter on my_string that calls emit_changed()?

I’m not sure what you are trying to work around, but that sounds correct. What is your end goal? Can you give a bigger picture?

I want to make it so that when properties are edited in the resource, they’re reflected in the editor - for example, editing my_string would update the value of a label