Errors when loading subresource with ResourceLoader

Godot Version



I’m having trouble loading a resource with subresources.

Currently, I’m implementing a save-load system by storing and retrieving a Resource with a .tres file. The main Resource (GameSave) holds subresources (ObjectSave), and everything seems to be saving correctly to user://ex-path.tres. However, when I try to load the resource back, I get an error(s) for each subresource in the file.

I’ve imported my .tres save file to check in-editor and all data seems to be set correctly. My subresource is pretty simple, holding only string, int, and Vector2. It does inherit from Resource, and all the properties are set correctly in the .tres file. I also tried redownloading Godot-mono from the official site. Mono is installed and up-to-date. My system OS is mac.

I would really appreciate any ideas or pointers. I don’t really understand the errors and am not sure where to go from here.

Most common error:

Failed to read file: '/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs'. 
Cannot load C# script file '/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs'. 
Failed loading resource: /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs. Make sure resources have been imported by opening the project in the editor at least once.

does that happen if you try with gdscript?

Yeah, it seems so.
I moved my debugging functions (just loading up the resource) to gdscript, but the same errors show up.

I was referring to defining the resource with gdscript. Not to mention, each class with gdscript must live on its own file

I’m trying to define my resource (ObjectSave) in its own gdscript file, but all my other C# scripts throw errors that indicate they cannot find the ObjectSave type. The file and class name is correct and there are no errors in the gdscript, so not sure why this is happening.

I’ll try to mess around with it more and I’ll update if anything changes. Otherwise, I may just have to find a work-around to all this.

I found the issue. I was using a constructor for my custom resource, and I didn’t realize we were not supposed to? I removed my constructor and replaced it with a function to set the values after instantiating. It removed the errors.

1 Like