Godot Crash on Packing the Main Scene
So, I'm trying to make a save system for my game, and I've settled on packing the main game scene into a packed scene, then loading that scene when I load the game. The problem is it only works occasionally, with all the other times crashing with a bunch of these errors:
error(-1): no debug info in PE/COFF executable
My save_game function (Which is in a Global script and called by pressing a button in the pause menu.):
func save_game():
`get_tree().paused = true`
`var packed_scene = PackedScene.new()`
`var propertyDict : Dictionary = {}`
`for object in get_tree().get_nodes_in_group("Persistant"):`
`var objectProps : Dictionary = {}`
`objectProps["path"] = object.get_path()`
`for prop in object.get_property_list():`
`if prop.name != "Reference" and prop.name != "script" and prop.name != "Script Variables":`
objectProps[prop.name] = object.get(prop.name)
`propertyDict[object.name] = objectProps`
`if object != game:`
`object.set_owner(game)`
###---Error Happens Here---###
`packed_scene.pack(game)`
`ResourceSaver.save(packed_scene,"res://Saves/save_game.tscn")`
`var save_game_objects_path = "res://Saves/save_game.txt"`
`var save_game_objects_file = FileAccess.open(save_game_objects_path,FileAccess.WRITE)`
`save_game_objects_file.store_var(propertyDict)`
`save_game_objects_file.close()`
`for key in propertyDict.keys():`
`var object = propertyDict[key]`
`get_node(object["path"]).set_owner(object["owner"])`
`print("Game Saved!")`
`get_tree().paused = false`
I've seen a bunch of people saying that this error is caused by the Forward+ Renderer, but this error still happens even when I use compatibility. I DO have 2 GPUs (a 3070ti and a 2060), but seeing as how this error happens randomly, I'm not 100% sure if that's even the problem.
Any help would be appreciated!
Edit: Sorry for the terrible markdown, I have no idea how to format it properly.