Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Cant Enable Plugin "There seems to be an error in the code" Locked

A topic by Death Reticle created Oct 12, 2021 Views: 1,729 Replies: 17
This topic was locked by TwistedTwigleg Mar 22, 2023

Closed due to inactivity.

Viewing posts 1 to 15

Godot_v3.3-stable_mono_win64         &         Godot_v3.3.4-stable_mono_win64

Hello, in the showcase project and development showcase I was able to open the projects with no problem and import the Twisted IK 2 without a problem either, however when I try to enable either plugin I receive an "Unable to load addon script from path: 'res://addons/TwistedIK2/TwistedIK_PluginRoot.cs' There seems to be an error in the code, please check the syntax." Error

I even tried the fix mentioned in the other forum post titled similarly but it had no effect.

Developer (1 edit)

Thanks for letting me know Death Reticle!

Does adding a C# script so Godot generates a C# project fix the issue? I’m not sure if that was the fix mentioned in the other forum post, but I know that sometimes Godot doesn’t see that there is C# scripts and will not allow the plugin to run if it doesn’t think it’s a C# project.

I’ll take a look and see if I can figure out what is going on! I might not be able to look today, but I will check tomorrow morning at the latest.

Edit: Okay, I get the same issue when opening and am looking into it 👍

Developer (1 edit)

Okay, I think I know what the issue is and how to fix it.

The issue is the included ".sln" and ".csproj" files in the development example and showcase project. If you delete these files and then hit the "Build" button in the top right corner, it should successfully rebuild the project. I didn't have the correct C# libraries installed on my Windows machine that I was using for testing, but once I got everything installed and hit the "Build" button, the project compiled successfully and then I was able to enable the plugins.

I would try deleting and regenerating the ".sln" and "csproj" files and see if that fixes it. If not, can you see if the terminal/console shows any output and if it does, paste it here or take a screenshot and post that? That way I can look into what is specifically causing the issue and see if I can find a solution!

the main scene of the project builds now, but I still can't enable the IK plugins.

I also received 13  errors that look kinda like this:

E 0:00:01.439   can_instance: Cannot instance script because the project assembly is not loaded. Script: 'res://addons/TwistedIK2/IK_3D/Twisted_ModifierDuoIK3D.cs'.

  <C++ Error>   Method failed. Returning: __null

  <C++ Source>  modules/mono/csharp_script.cpp:2902 @ can_instance()

I can't seem to enable the plugin no matter what I try :(

Yeah, I seem to be having the same issue. Not sure how to help, sorry :/

Developer

Are you getting the exact same error messages showing something like “Cannot instance script because the project assembly is not loaded”?

Developer

Sorry for the delay, it's been a busy several days and I didn't get any notifications there was replies, so I completely missed these posts until now!

Have you used any C# scripts in your project, without necessarily Twisted IK 2 enabled? It seems like it might be something with compiling C# scripts that is causing the issue, at least I think that may be the issue. Can you make a new project, add a C# script, and then see if it builds and runs successfully? The script doesn't need to have anything in it, I don't think, but it may help narrow down if the C# build process itself is causing the issue or if it's something else.

Also, are all the issues mentioning "Cannot instance script because the project assembly is not loaded"? Does the top issue mention anything else, as it could be that one of the issues is causing all the others.

Sorry again for the delay in reply and for the incontinence!

Developer (1 edit)

looking online, it may be a naming issue that is causing the problem, if this issue on GitHub is what is causing the issue here too.


Edit: Switching to Mono may also help fix the issue according to this Stackoverflow post. Based on what I can find online, it seems the issue associated with the errors is more on the C# end with project names and stuff than code, but I am not sure what is triggering the issue in this case.

(5 edits)

Hello! I'm having the same issues.

I have the Mono 64-bit version of Godot downloaded, and the "Mono 64-bit (no GTK#)" installed from here: https://www.mono-project.com/download/stable/  as well as the  .NET Core SDK 3.1 x64 version.

I created a new project, added a node, and added an empty .cs file to it. I clicked build and the build failed, so I went to Editor > Editor Settings > Mono > Builds > and switched "Build Tool" to "MS Build (Mono)". I tried running the project again, and this time it succeeded.

I added the "addons" folder from the "Free_Twisted_IK_2.zip" to the root of "Development_Example_Project" and opened the project up. I opened up "3D_Test_Scene_1.tscn" and clicked "Play Scene" (the project is using "MSBuild (Mono)") and the scene was able to build, but stops after a few seconds and throws these errors:

"""
can_instance: Cannot instance script because the project assembly is not loaded. Script: 'res://addons/TwistedIK2/IK_3D/Twisted_ModifierLookAt3D.cs'.
  <C++ Error>   Method failed. Returning: __null
  <C++ Source>  modules/mono/csharp_script.cpp:2907 @ can_instance()
"""


When navigating to Project > Project Settings > Plugins the "TwistedIK2" and "TwistedIK2 Editor Plugin" are visible, but neither is enabled. Clicking "Enable" on either of them gives the error:
"""
Unable to load addon script from path: 'res://addons/TwistedIK2/TwistedIK_PluginRoot.cs'. This might be due to a code error in that script.
Disabling the addon at 'res://addons/TwistedIK2/plugin.cfg' to prevent further errors.
"""

The paid addon and "Twisted_IK_2_Showcase_Project" have the same issues described above.

(1 edit)

Ok, a second update where I got things working.

I uninstalled Mono from my computer, and made sure that the only version of .NET Core SDK 3.1 was the x64 version. If the incorrect version was installed, you need to make sure that it's not still in your PATH either.

(Right click Windows Start Button > System > Advanced system settings (on the right) > Advanced (Tab) > "Environment Variables" button > Click "Path" in the bottom "System Variables" window > "Edit..." button > Scroll down to bottom and you should see "C:\Program Files\dotnet\")

If that looks good, then you need to go to one of the example projects and open up a scene, for instance "3D_IK_Dino_FABRIK.tscn" and add a new completely blank C# script to the root node. Since I no longer have Mono installed I went to Editor > Editor Settings... > Mono > Builds > Build Tool and changed it to "dotnet CLI".

I clicked "Play Scene" and it started just fine. I was then able to go back and enable the Plugins.

Edit: Actually, I'm still having trouble running the "Development_Example_Project" scenes. They can build fine, but I get this error: https://github.com/godotengine/godot/issues/6393

Developer

ARCarr - Thanks for the detailed information! This will be quite helpful for trying to figure out what is going on. I'm wondering if it's a Window specific issue, though I'm still not sure why it is occurring, as I haven't been able to reproduce it on my machine. I will need to test again though, maybe something in a recent Godot version changed something.

For issue 6393: have you tried closing and reopening the Godot editor? If you have multiple instances of the Godot editor open, closing all of them and then reopening the scene may help. I believe it is related to trying to save the ".tscn" file.

Developer

I tried using Godot 3.3.4 Mono stable on my Windows 10 development machine and it works there. I did initially have the issue where it said it couldn't enable the plugin, but I hit "build" and after the build I was able to enable it and it worked after that. I think on Windows I only have the "dotnet CLI", so that might be why I wasn't able to reproduce the issue locally.

I realize this is now an old thread, but I get the same issue:

Unable to load addon script from path: 'res://addons/TwistedIK2/TwistedIK_PluginRoot.cs'. This might be due to a code error in that script. Disabling the addon at 'res://addons/TwistedIK2/plugin.cfg' to prevent further errors.

Developer (2 edits)

Have you tried deleting the C# project and solution, adding a C# script (can just be the default Godot-generated one), building the project, and then enabling it again? That is what I would try doing if you have not already, as the plugin was last updated for a version of Godot that was a few releases ago, so its C# generated files probably are out of date and need to be regenerated.

If that does not work, please let me know. If you could also include your OS (Windows, Mac, Linux), Godot version, and possibly the log file, that would be great as it would help me narrow down what the issue is.

Thanks!

I'm on windows 10, godot 3.4.2. 

I'm not familiar with the C# version of godot to understand how to troubleshoot what you suggest. I must be missing steps for general use. Clicking Build also results in error, "Failed to build project solution." Before trying this plugin I have never used anything but the standard gdscript godot.

Developer

I would recommend checking out the C# basics page on the Godot documentation if you are new to C#, just to make sure you have everything setup and can compile a basic script in a C# Godot project. I would disable the plugin while you are doing this, as otherwise it will not compile

Then after you have the C# Godot project compiled correctly, I would then try enabling the plugin and see if that fixes the issue 🙂

Developer (1 edit)

Closing this as it's been almost a year since the last reply. Please feel free to make another post if this is still an issue. Thanks!

Developer locked this topic