Autoloading a resource?

Godot Version

4.3

Question

so Im working on a roguelike and Im storing all the run info in a resource so I can store it in memory in case the player needs to step away. The problem is I don’t know whats the best way to access it. I can’t just autoload a resource so tried making a dummy script whose sole purpose is to store the resource but that doesn’t seem to have worked either. anyone more familiar with godot know what I should do?

You can autoload/global a script if it extends a Node, what is your script supposed to do? You have an error about property ‘playerHand’ but this script doesn’t contain that variable, nor a line trying to access it.

nevermind I think I figured it out. For those struggling with the same problem heres my game_state_holder script. which is a dummy script meant to hold my game_state.gd resource inside of a node/script that I can then autoload

extends Node
	# this is fucked
var gs : GameStateManager
func _ready() -> void:
	gs = GameStateManager.new()

ok maybe not.
heres my game_state.gd resource if it helps.



# current Game Progress & other
var floor : int

# player specific stats
enum PlayerClasses {WARRIOR, MAGE, RANGER}
var playerclass : PlayerClasses
var playerDeck : CardPile
var playerHand : CardPile
var playerDiscard : CardPile
var playerPower
var playerStrengthLevel : int
var playerHandSize : int

# dungeon spefic stats
var dungeonDeck : CardPile
var dungeonHand : CardPile
var dungeonDiscard : CardPile
var dungeonHandSize : int

func reset() -> void:
	floor = 0
	playerclass = PlayerClasses.WARRIOR
	playerDeck = CardPile.new()
	playerHand = CardPile.new()
	playerDiscard = CardPile.new()
	dungeonDeck = CardPile.new()
	dungeonHand = CardPile.new()
	dungeonDiscard = CardPile.new()
	playerHandSize = 5
	dungeonHandSize - 5

func new_game() -> void:
	reset()

func game_over() -> void:
	pass

func end_floor() -> void:
	pass

func new_floor() -> void:
	pass

What’s the issue? Did you get an error? please explain what happened vs what you expected to happen.

Please paste scripts instead of screenshots