Godot Version
4.3
Question
Hello,
I don´t understand this reddit thread:
https://www.reddit.com/r/godot/comments/1ax6mae/safe_usage_of_resourcesaver/
What is the difference between saving a game as a Resource using the ResourceSaver and saving it e.g. as a dictionary?
Couldn´t I save a Resource that contain a dictionary? Wouldn´t that be the same?
Sorry if my question sounds stupid, but I am just learning to code by myself.
I am using e.g. this to save my upgrade stats from the in-game shop and now I am worried, that I might be doing something wrong.
extends Control
@export var upgrade_shop_levels: UpgradeShop # Upgrade shop is Resource class
# Called when the node enters the scene tree for the first time.
func _ready():
upgrade_shop_levels = load("res://Ressources/upgrade_shop.tres")
$VBoxContainer.size = Globals.viewport_dimensions
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _on_button_help_button_up():
$InGameShopHelpOverlay.show()
func _on_button_buy_coin_multi_pressed():
upgrade_shop_levels.set_coin_multi_lvl(upgrade_shop_levels.coin_multi_lvl +1)
_save_upgrade_shop()
func _save_upgrade_shop():
ResourceSaver.save(upgrade_shop_levels, "res://Ressources/upgrade_shop.tres")
Best regards,
Jayme