Custom Resources saving not working in 4.6.3 anymore

Godot Version

4.6.3

Question

Hi, i did update from 4.4 to 4.6.3. Now my plugin to edit and save resources not working anymore. When i edit and save a .tres i can see the changes in the inspector. When going to the file system and open the .tres with notepad, there are no changes. ResourceSaver.save gives me no errors. For sure, when running the game the loaded .tres is also without changes. Any idea?

func on_save_button_pressed():

    var npc_prop = npc_dropdown.get_item_text(npc_dropdown.selected)
    var error = ResourceSaver.save(current_npc_prop, "res://resources/npc_properties/" + npc_prop + ".tres")
    if error != OK:
        printerr("Failure!")
    else:
        print("NPC property: " + str(npc_prop) + ".tres saved!!!")
    load_npc_properties()

already tried (with no luck):


current_npc_prop.take_over_path("res://resources/npc_properties/" + npc_prop + ".tres")
current_npc_prop = current_npc_prop.duplicate(true)

This might be a long shot but do you use @export in the variables that you want to be saved? That’s how resources are serialized and saved in the system. I had the same issue where the variables would just reset, and adding @export & @export_storage worked for me.

Also I see that you’re saving it to the “res://”, but you should use “user://” for saving data and loading it in runtime. Hope these two will fix your issue.

For sure i used @export.
Saving is done via EditorPlugin. Only loading in game, for now. I am aware to change or create data for saving in user:// later.

In 4.4 everything works fine.