Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Windows: Unable to load addon script from path. This might be due to a code error in that script. #33

Open
hsandt opened this issue May 16, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@hsandt
Copy link

hsandt commented May 16, 2023

The addon worked fine on Linux, but when I reopened the project on Windows I got this every game start:

Warning
Unable to load addon script from path: 'res://addons/smoothing/smoothing_plugin.gd’. This might be due to a code error in that script.
Disabling the addon at 'res://addons/smoothing/plugin.cfg' to prevent further errors.

Godot 4 0 2 Windows - Cannot enable smoothing addon

If I open the Project Settings I can see the addon is disabled. Enabling it then re-disabling it confirms disabling and will stop showing the error. In this case you cannot Add more Smoothing2D nodes, but the existing nodes will still work.

So technically it shouldn't break exported games.

@lawnjelly
Copy link
Owner

lawnjelly commented May 16, 2023

Yes I never worked out what was causing this, whether it was a problem in the addon or in the engine.
I reported in:
godotengine/godot#39921

It seemed to occur as a one off, and then the addon worked fine, so I never paid too much attention, assuming it maybe was an engine bug. It looks as though it may be something to do with paths, maybe capitalization or snake case. 🤔

@SneezingCactus
Copy link

If it helps, I've just gotten a similar error upon attempting to enable the plugin on Linux, and to fix it I had to manually reimport both icon PNGs (smoothing.png and smoothing_2d.png).

@lawnjelly lawnjelly added the bug Something isn't working label Sep 26, 2023
@pcloves
Copy link

pcloves commented Oct 28, 2023

After long time trying (4.2.0-beta.3), I find a scenario that caused this issue: the plugin C# file name is inconsistent with the C# class name. When I renamed the C# class to match the file name, the issue disappeared.

@rrweller
Copy link

After long time trying (4.2.0-beta.3), I find a scenario that caused this issue: the plugin C# file name is inconsistent with the C# class name. When I renamed the C# class to match the file name, the issue disappeared.

I'm also having this issue however Godots not letting me enable the plugin at all. Can you explain more what you did to fix it?

@lawnjelly
Copy link
Owner

After long time trying (4.2.0-beta.3), I find a scenario that caused this issue: the plugin C# file name is inconsistent with the C# class name. When I renamed the C# class to match the file name, the issue disappeared.

This sounds great! 👍

But I'm not clear on what you have changed exactly, if you can spell it out step by step exactly which things you changed maybe we can fix. Also the plugin doesn't use C# (it is gdscript), so this is a little confusing.

@pcloves
Copy link

pcloves commented Oct 30, 2023

After long time trying (4.2.0-beta.3), I find a scenario that caused this issue: the plugin C# file name is inconsistent with the C# class name. When I renamed the C# class to match the file name, the issue disappeared.

This sounds great! 👍

But I'm not clear on what you have changed exactly, if you can spell it out step by step exactly which things you changed maybe we can fix. Also the plugin doesn't use C# (it is gdscript), so this is a little confusing.

Sorry, I just realized that I came to the wrong place (I searched on google at that time, then opened two web pages, one is Godot issue page, the other is this one. I didn't notice that this page is not the Godot's issue page).

I was developing a C# plugin at that time and got the same issue. Here's the thing:

  1. in the plugin.cfg, I configured: script="BehaviorPlugin.cs"
  2. The class name in BehaviorPlugin.cs wasn't same as BehaviorPlugin (such as: public partial class MyPlugin : EditorPlugin)
  3. This issue happened.
  4. When I change the class name to: BehaviorPlugin the issue disappeared.

@lawnjelly
Copy link
Owner

This does sound possible, that the error message is not useful, and maybe even the example in the documentation is wrong. Will investigate! 👍

@the-old-one
Copy link

For those still getting this error. Make sure you're on the right branch when copying the plugin. The default branch of the project is 3.x! So you have to switch to 4.x manually after cloning. I've got this error after copying the 3.x version to a Godot 4.3 project.

@lawnjelly maybe it's time to set the default branch to 4.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants