You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Getting "Parser Error: Class "WorkResource" hides a global script class" with stack frame "0 - gdscript://-9223371970299558721.gd:1 - at function:" when trying to FileAccess.get_var from "user://work_resource.save", which stores a WorkResource instance.
There is no other scripts nor autoloads of the same name.
No embedded scripts in .tscn files also.
data_saver_loader.gd (DataSaverLoader autoload):
extendsNodeconstUSER_DIR: String="user://"constSAVE_EXT: String=".save"# Tested with this off - same resultsfunc_ready():
ifOS.is_debug_build():
forpathinDirAccess.get_files_at(USER_DIR):
DirAccess.remove_absolute(USER_DIR+path)
# This appears to be the problemfuncload_var(name: String, value_if_null: Variant=null) ->Variant:
varpath: String=USER_DIR+name+SAVE_EXTvarresult: Variant=value_if_nullifFileAccess.file_exists(path):
result=FileAccess.open(path, FileAccess.READ).get_var(true)
returnresult# Works flawlessly (I guess?)funcsave_var(name: String, value: Variant) ->void:
varpath: String=USER_DIR+name+SAVE_EXTFileAccess.open(path, FileAccess.WRITE).store_var(value, true)
work_resource.gd:
class_nameWorkResourceextendsResource@exportvarbackground: Texture2D@exportvaricon: Texture2D@exportvarsound: AudioStream@exportvarid: String@exportvarname: String@exportvarsalary: int@exportvarcost: int
work.gd (Where DataSaverLoader.load_var is called):
extendsControl@exportvardefault_resource: WorkResource@exportvarbackground: TextureRect@exportvaricon: TextureRectconstSAVE_NAME: String="work_resource"func_ready():
# I suppose this is where it crashesvarresource: WorkResource=DataSaverLoader.load_var(SAVE_NAME)
ifresource==null:
resource=default_resourceDataSaverLoader.save_var(SAVE_NAME, resource)
background.texture=resource.backgroundicon.texture=resource.icon
Steps to reproduce
Start a new Godot project
Create a simple subclass of Resource
Save instance of it via FileAccess.open("user://something.save, FileAccess.WRITE).store_var(instance_, true)
Try to load it with FileAccess.open("user://something.save, FileAccess.READ).get_var(true)
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered:
Godot version
4.1.2.stable
System information
Godot v4.1.2.stable - elementary OS 6.1 Jólnir - X11 - Vulkan (Mobile) - integrated AMD Radeon Vega 8 Graphics (RADV RAVEN) () - AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx (8 Threads)
Issue description
Getting "Parser Error: Class "WorkResource" hides a global script class" with stack frame "0 - gdscript://-9223371970299558721.gd:1 - at function:" when trying to FileAccess.get_var from "user://work_resource.save", which stores a WorkResource instance.
There is no other scripts nor autoloads of the same name.
No embedded scripts in .tscn files also.
data_saver_loader.gd (DataSaverLoader autoload):
work_resource.gd:
work.gd (Where DataSaverLoader.load_var is called):
Steps to reproduce
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: