FileAccess crashes project when attempting to get a stored variable containing a custom resource. Any solutions?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By averyknight

I have these two functions to store and load a character’s variables:

var variable_container: CharacterVariables

func save_to_file(file: FileAccess):
	# Unrelated code.

	file.store_var(variable_container.inventory, true)

func load_from_file(file: FileAccess):
	# Unrelated code.



One of the variables I want to store is the character’s inventory. The inventory variable itself is an array that contains either null or a custom resource called ItemAsset.


The save_to_file() function works regardless of what inventory contains.

However, the load_from_file() function works only if inventory did not contain any ItemAsset when it was saved; if it did, the project crashes when load_from_file() is called.

This also happens if inventory contained other custom resources when it was saved.


Debugger Tab

Parser Error: Class "ItemAsset" hides a global script class.

The 0- :1 - at function: is pretty weird, too.


Output Tab

--- Debugging process started ---
Godot Engine v4.0.beta4.official.e6751549c -
Vulkan API 1.2.0 - Using Vulkan Device #0: AMD - AMD Radeon(TM) Graphics

  editor/debugger/debug_adapter/debug_adapter_types.h:70 - Condition "path.is_empty()" is true.
--- Debugging process stopped ---
  Resource file not found: res://.


Does anyone know how to solve this? I have tried using a newer version (v4.0.beta6.official [7f8ecffa5]), but nothing changes.

:bust_in_silhouette: Reply From: Juxxec

This appears to be a bug, you can find more info here: Reddit - Dive into anything and exporting layer(bit mask) variables to inspector · Issue #27695 · godotengine/godot · GitHub