I've defined an array of custom resources with setget that limits the type.
However, after changing the value of a resource, I noticed that the value is not reflected until I press the save button on the inspector.
extends Resource
tool
export(Array,Resource) var resource_array setget _set_array
func _set_array(new_value : Array):
var helper = DataHelper.new()
resource_array =helper.CreateArray(new_value,audiostream)
func CreateArray(new_value,from_resource) -> Array:
var result = []
for element in new_value:
var elem = element
if elem == null:
elem = ResourceBase.new()
elem.m_resource = from_resource.duplicate()
result.append(elem)
return result
When I refer to the resource in the tool script, the changed data is reflected, but the
When I run the game, the values are not reflected; when I open the tres file, the changed values are not written.
I am afraid of forgetting to save and losing data, so I want to execute the inspector's save button from a script or with a shortcut key.
I tried propertylistchanged_notify() but it did not work.