Topic was automatically imported from the old Question2Answer platform.
Asked By
ggez
E 0:00:01.131 can_instance: Cannot instance script because the class 'Interface' could not be found. Script: 'res://Interface.cs'.
<C++-Fehler> Method failed. Returning: __null
<C++-Quellcode>modules/mono/csharp_script.cpp:2942 @ can_instance()
<Stacktrace> :0 @ Int32 Godot.NativeCalls.godot_icall_1_187(IntPtr , IntPtr , System.String )()
SceneTree.cs:637 @ Godot.Error Godot.SceneTree.ChangeScene(System.String )()
SceneChanger.cs:24 @ Boolean
I don’t know why it says class can not be found. The node with that script is in the scene tree. There are also no compiler errors or anything. Any ideas?
looks like an old question but since I’t the first in google It might still be useful.
I don’t know exactly what is happening here, but I have a similar problem. I found that if the constructor code (or field initialization) raise an exception this is the error you get.
moving the suspicious code to _ready helped me discover the hidden exception
I had this same issue, but I managed to find and fix it.
From what i can tell, it happens when the name of the script(i.e. “PlayerMovement.cs”), doesn’t match the “class name” (i.e. “public class Player : Node”).
Just replace the “class name” with the file name.
(I.E. “public class PlayerMovement : Node”).