derkork / godot-resource-groups

An add-on for the Godot engine that simplifies handling of resources
MIT License
136 stars 6 forks source link

Intermittent build fail - Could not find type "ResourceGroupBackgroundLoader" #5

Open zacharybil opened 3 months ago

zacharybil commented 3 months ago

My project fails to start intermittently with "Parser Error: Could not find type "ResourceGroupBackgroundLoader" in the current scope." called from resource_group.gd:69.

I can't find any other debug information but I'm new to Godot so maybe I just don't know where to look. image

I find it strange that this error occurs because I am using the C# API and as far as I know I'm not using the background loader. The references from script files I have to the addon are:

using GodotResourceGroups;
private ResourceGroup _allCards;
_allCards = ResourceGroup.Of("res://Data/AllCards.tres");

If the issue happens it will always start successfully when hitting play again. My best guess is it's a timing issue related to Godot reloading files after they've been edited in another text editor. I use VSCode to edit C# script files and the issue will occur quite consistently when I make script changes in VSCode, alt-tab to Godot and then hit play. It doesn't seem to happen if I make script changes in the Godot editor and then hit play

derkork commented 3 months ago

This sounds a lot like https://github.com/derkork/godot-statecharts/issues/93 // https://github.com/godotengine/godot/issues/83561, i have a feeling that there is something messed up with Godot right now when using an external editor. The C# API is only a very thin wrapper around the GDScript API so you're always going to need the GDScript API under the hood. I currently have no idea how to fix this as it seems to be a problem with the engine itself rather than the library.