- Edited
Hello! I’m still fairly new to Godot, and I don’t understand why the text for my Label won’t update.
Here is the code from my Autoload scene:
@export var value = Label
func sanddollar_caught():
sanddollar += 1
print(sanddollar) #testing
value.text = str(sanddollar)
print(value.text) #testing
I’m trying to call the function to update the label text for value
, and it isn’t a problem with the function not being called as both print
commands work (with their correct values), but even though it’s printing value.text
correctly as the updated value, the displayed text isn’t.
Loading value.text
works fine (displays “2” but stays as “2” after sanddollar_caught
function is called)
func load_data():
if FileAccess.file_exists(save_path):
var file = FileAccess.open(save_path, FileAccess.READ)
var stored_data = file.get_var()
print(stored_data)
value.text = stored_data.get("valuetext", "0")
value.text = "2" #testing
fish1 = stored_data.get("fish1", [])
sanddollar = int(value.text)
print("Loaded")
func _ready():
load_data()