Possible cyclic resource inclusion on empty project

Godot Version

4.2.2

Question

Hello
I am working on a game in c#. After a while, I created a new script, and got the error “Another resource is loaded from path ‘res://new_script.cs’ (possible cyclic resource inclusion).”

I tried to remove the code in the new script, but I still get the error if it is empty. I also tried to create a new project, and still get the error. I have one scene, and one c# script. The script is empty. I still get the error.

I have no idea if it is even a programming problem, since the error persists in any project that I make to test it.

Thank you for your help

Edit.
I have a script called main. When I called the script that initially started the problem main2, the error disappeared. However, I have tested with names such as “something”, “test”, “thing”, “foo”, and in all cases still had the error

Hi,
Hard to say without seeing the code. Could you upload the project?

I’d avoid using Class names call main. Also you want to be saving script files with the same name & case of the class. C# Class names should be in PascalCase. Every word starts with a Capital letter. Save the script with the same name.
Make sure you’re not loading scripts multiple times on different nodes. I think you can do it, but I’d say it’s probably not best practice and this is where inheritance can jump in.

Hello

Thank you for replying.Why should I not be using main as a class name?
Could you please tell me how to upload the project?

All I did was create a new scene, with a single node, and attached a c# script to it. the problem also does not appear if the script is in gdscript. There is no code in the script.

Yeah it is odd. Not sure why it could be doing it. You could upload the code and share a link with something like Dropbox, Google drive or We Transfer. Just don’t put any personal info in your code.

C++ & C# use the main class as an entry point for the executable. So somewhere deep inside Godot there could be a main class. I’m not 100% sure about that, but it’s easy to avoid using the name.

Hi

I tried to rename main to GameMaster, and got the same error.
Also, this is the link to the minimal project where I got got the error

https://www.dropbox.com/scl/fo/i6uf6wvcg1mf88cxpsc3m/ANp7WZ1dJGPYjzCK04RFCnQ?rlkey=83yrav5v11ym8x311rnv0nv7v&st=y5qfka7b&dl=0

I have just created the project, and attached a .cs file to a node. If you need the main project, I can link to that as well.

Figured it out.
clicking build fixed it.
Thank you for all your help

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.