Resource loading: lack of understanding

Godot Version

4.3

Hello,

I have a lack of understand of what is going on in my script.
I created resources to save power ups and some other stats.
I load them in the following way:

extends Node2D
@export var stats: GlobalStats 
@export var upgrade_stats: UpgradeShop

func _ready():
	stats = load("res://Ressources/global_stats.tres")
	upgrade_stats = load("res://Ressources/upgrade_shop.tres")

The “stats” and “upgrade_stats” variables do take over the values of their corresponding resource but I can see in the inspector that there is basically a copy of the resource variables and all with the value zero.
Why is that? Shouldn´t they be the original values?
How can I change those values?


`

Best regards!
Jayme

The debugger may be showing incorrect values, is the above “Members” section more accurate to that resource?

The members seem to be showing the values of the created variables:
@export var stats: GlobalStats
@export var upgrade_stats: UpgradeShop

Meaning, that if I update a variable in script, those members change accordingly. They behave as expected.

Cool, the rest are visual glitches; disregard the extras.

1 Like

Thank you! Well that´s annoying but at least it´s going to stop nagging me if I am doing something wrong

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.