Godot: Mono - Cannot instance script because the project assembly is not loaded (When using --path)

Created on 2 Jan 2020  路  8Comments  路  Source: godotengine/godot

Godot version:
3.2 beta 4 Mono

OS/device including version:
Windows 10

Issue description:
When the project is run directly using --path It cannot load any c# scripts

Steps to reproduce:
Run the project using a command like
.\GodotMono.exe --path C:\Users\You\Documents\Test\ -v

Log:

Godot Engine v3.2.beta4.mono.official - https://godotengine.org
Using GLES3 video driver
OpenGL ES 3.0 Renderer: AMD Radeon R7 200 Series
WASAPI: wFormatTag = 65534
WASAPI: nChannels = 2
WASAPI: nSamplesPerSec = 48000
WASAPI: nAvgBytesPerSec = 384000
WASAPI: nBlockAlign = 8
WASAPI: wBitsPerSample = 32
WASAPI: cbSize = 22
WASAPI: detected 2 channels
WASAPI: audio buffer frames: 1962 calculated latency: 44ms

Mono: Initializing module...
Mono JIT compiler version 6.6.0 (explicit/bef1e633581)
Mono: Logfile is: C:\Users\Franke\AppData\Roaming/Godot/mono/mono_logs/2020_01_02 13.52.39 (9868).txt
Mono: Runtime initialized
Mono: Loading assembly mscorlib...
Mono: Assembly mscorlib loaded from path: C:\Program Files\Godot/GodotSharp/Mono/lib/mono/4.5/mscorlib.dll
Mono: Loading scripts domain...
Mono: Creating domain 'GodotEngine.Domain.Scripts'...
Mono: Debugger wait timeout
Mono: INITIALIZED
Mono: Loading assembly GodotSharp...
Mono: Assembly GodotSharp loaded from path: res://.mono/assemblies/Debug/GodotSharp.dll
Mono: Loading assembly GodotSharpEditor...
Mono: Assembly GodotSharpEditor loaded from path: res://.mono/assemblies/Debug/GodotSharpEditor.dll
Mono: Loading assembly GodotTools...
Mono: Assembly GodotTools loaded from path: C:\Program Files\Godot/GodotSharp/Tools/GodotTools.dll
Mono: Loading assembly GodotTools.ProjectEditor...
Mono: Assembly GodotTools.ProjectEditor loaded from path: C:\Program Files\Godot/GodotSharp/Tools/GodotTools.ProjectEditor.dll
Mono: Loading assembly Test...
Mono: Failed to load project assembly
CORE API HASH: 1133556406507282606
EDITOR API HASH: 9577969821152247287
Loading resource: res://default_env.tres
Loaded builtin certs
Loading resource: res://Space.tscn
Loading resource: res://Star.tscn
Loading resource: res://Star.gd
Loading resource: res://CelestialBody.gd
Loading resource: res://Spaceyy.cs
ERROR: Cannot instance script because the project assembly is not loaded. Script: 'res://Spaceyy.cs'.
   At: modules/mono/csharp_script.cpp:2774
Mono: Unloading scripts domain...
Mono: Runtime cleanup...
debugger-agent: Unable to listen on 5900
Mono: Finalized

Minimal reproduction project:
Test.zip

bug mono

Most helpful comment

I've got the same error on macOS(godot 3.2.2), after I changed the project name in project setting when I have another godot project opened.
Now my project is broken.

All 8 comments

A similar issue has been fixed in master/3.2 recently (though it seems to me that it was a regression from other post-3.2 changes). Would be good to check if this is still reproducible in the current 3.2 branch or upcoming 3.2.2 test builds.

I can confirm the issue still exists with the above test project and 3.2.x @ 0e43565a7c64c40d5b18fd0e4ce171cc1186cb33

ERROR: Cannot instance script because the project assembly is not loaded. Script: 'res://Spaceyy.cs'.
   At: modules\mono\csharp_script.cpp:2897

Same error for me:
image
I am getting this when exporting for Android and not when using --path as @nathanwfranke. When exporting for windows it works normaly. Happens with Stable version of Godot and also with 3.2.2.rc.mono.

I just started using Godot ( version 3.2.1-stable_mono_win64) and I have this issue. I changed the name of my project once and now none of the scripts will work. Even after restarting the editor, and changing the name back it's still not working. Is there a fix for this? I would hate to lose my work.

ERROR: Cannot instance script because the project assembly is not loaded. Script: 'res://Scripts/Menu/MultiPlayer.cs'.
At: modules/mono/csharp_script.cpp:2912

ERROR: can_instance: Cannot instance script because the project assembly is not loaded. Script: 'res://Main.cs'.
At: *modules/mono/csharp_script.cpp:2892
.*

I've got the same error on macOS(godot 3.2.2), after I changed the project name in project setting when I have another godot project opened.
Now my project is broken.

I've got the same error on macOS(godot 3.2.2), after I changed the project name in project setting when I have another godot project opened.
Now my project is broken.

Try to do this.
Open the "project.godot" file and check that the "config / name" section has the same name as the project folder.

browse/open the files and change any old name to the new one

Try to do this.
Open the "project.godot" file and check that the "config / name" section has the same name as the project folder.

After renaming my project, this fixed it. I had to manually rename the .csproj and .sln files, and update the .sln file itself. Now, it works.

It would be great if Godot could report this error clearly and early (like when you load a C# project) when this happens.

Was this page helpful?
0 / 5 - 0 ratings