Godot Version
4.4
Question
I use Custom Resources in my game to assign effects to items. When I update a value in any of my saved .tres
effect custom resources, the values won’t update in exported versions of the project. This does not happen when running the project from the editor. I’m not using code to load these resources, they are all saved as .tres
files and assigned to exported variables inside item scenes.
My custom resources look something like this
extends Resource
class_name ItemEffect
@export var damage : int = 0
...
and my item class like this
extends Node2D
class_name Item
@export var item_effect : ItemEffect
...
You can reproduce the issue like this:
- Make a script that extends
Resource
with an@export
ed variable; - Make a resource from this script, modify the variable’s value and save it as a .tres file (let’s say
Custom.tres
); - Make a scene that takes your custom resource as an exported variable and assign
Custom.tres
to it; - Make the scene
print()
the modified variable (or show it on a label) and run it in the editor; - Change the variable in
Custom.tres
, save it and run the project in the editor again; - Export the project and run the exported version.